Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Crosstab Query not working

Status
Not open for further replies.

MedicSkip

Technical User
Feb 16, 2003
2
US
I have a table (tblCalls) listing Sta, Date, Time. I am trying to get a crosstab query to give me the count of events (Time) occurring in hourly increments (00:01 - 00:59, 01:00 - 01:59, etc.) for Sta on certain Date.

New to crosstabs and the wizard isn't helping.

Any info would be GREATLY aprreciated.

Thanks in advance.
 
I will give you an example that I use that on days which you can modify. It assigns a value of 1 or 0 depending if the value falls in the particular grouping. It sums the values to give a count of items in each category. BTW this is not a crosstab query. Paste it into access and take a look at the logic.

The output for this query looks like this:

Inbox 7 Days 14 Days 21 Days >21 Days
Field1 0 6 5 3
Field2 1 0 0 2


SELECT dbo_tg_WeeklyAging.Inbox, Sum(IIf(DateDiff("d",[DateCreated],Now()) Between 0 And 7,1,0)) AS [7 Days], Sum(IIf(DateDiff("d",[DateCreated],Now()) Between 8 And 14,1,0)) AS [14 Days], Sum(IIf(DateDiff("d",[DateCreated],Now()) Between 15 And 21,1,0)) AS [21 Days], Sum(IIf(DateDiff("d",[DateCreated],Now())>=22,1,0)) AS [>21 Days]
FROM dbo_tg_WeeklyAging
GROUP BY dbo_tg_WeeklyAging.Inbox;

Trisha
padinka@yahoo.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top