I know how to get the results I want with two queries, but would like to use only one query. The following is as abbreviated and concise as possible.
My first table [Items] contains two relevant fields:
ItemID (int) and GroupNum (varchar).
The second table [Call] contains three relevent fields:
ItemID (int), Started (smalldatetime) , Voicemail (smalldatetime) .
These are the results I would like:
GroupNum, Count(NOT Voicemail IS NULL), COUNT(DATEDIFF( n, Voicemail, Started) > 60)
I would like the results grouped by by the group number, the total count where the voicemail is not null, and the total count where the date difference in minutes between started and voicemail is greater then 60.
I can join the table, and I can’t get the group number and one OR the other of the two remaining fields, but not both.
Any help would be greatly appreciated
My first table [Items] contains two relevant fields:
ItemID (int) and GroupNum (varchar).
The second table [Call] contains three relevent fields:
ItemID (int), Started (smalldatetime) , Voicemail (smalldatetime) .
These are the results I would like:
GroupNum, Count(NOT Voicemail IS NULL), COUNT(DATEDIFF( n, Voicemail, Started) > 60)
I would like the results grouped by by the group number, the total count where the voicemail is not null, and the total count where the date difference in minutes between started and voicemail is greater then 60.
I can join the table, and I can’t get the group number and one OR the other of the two remaining fields, but not both.
Any help would be greatly appreciated
Comment