Counting Query

L

Love Buzz

Hi all.

I am sure this is an easy question. With the query below I am trying to
count the number of records in a queue, and then group the results as you see
below. It is counting fine, but the result is not the total for that queue.
It looks like the total for that queue for one day. For example, when I
select the range of 07/01 through 07/31, I get 22 individual totals for a
particular queue instead of just one total count for the time period I
selected.

I hope that made sense. Thanks for your help.

SELECT [Incoming Return Item Detail].Type, [Incoming Return Item
Detail].queue, Count([Incoming Return Item Detail].queue) AS CountOfqueue,
[Queues and Descriptions].[Queue Name], [Incoming Return Sources].[Source
Name]
FROM [Incoming Return Sources] INNER JOIN ([Incoming Return Item Detail]
INNER JOIN [Queues and Descriptions] ON [Incoming Return Item Detail].queue =
[Queues and Descriptions].Queue) ON [Incoming Return Sources].Source =
[Incoming Return Item Detail].Source
WHERE ((([Incoming Return Item Detail].Date) Between [Start Date] And [End
Date]))
GROUP BY [Incoming Return Item Detail].Type, [Incoming Return Item
Detail].queue, [Queues and Descriptions].[Queue Name], [Incoming Return
Sources].[Source Name]
HAVING ((([Incoming Return Item Detail].Type)=" X937"));
 
L

Lord Kelvan

can you paste some of the results form that query and highlight where
the problems are in the results
 
J

John W. Vinson

Hi all.

I am sure this is an easy question. With the query below I am trying to
count the number of records in a queue, and then group the results as you see
below. It is counting fine, but the result is not the total for that queue.
It looks like the total for that queue for one day. For example, when I
select the range of 07/01 through 07/31, I get 22 individual totals for a
particular queue instead of just one total count for the time period I
selected.

I hope that made sense. Thanks for your help.

SELECT [Incoming Return Item Detail].Type, [Incoming Return Item
Detail].queue, Count([Incoming Return Item Detail].queue) AS CountOfqueue,
[Queues and Descriptions].[Queue Name], [Incoming Return Sources].[Source
Name]
FROM [Incoming Return Sources] INNER JOIN ([Incoming Return Item Detail]
INNER JOIN [Queues and Descriptions] ON [Incoming Return Item Detail].queue =
[Queues and Descriptions].Queue) ON [Incoming Return Sources].Source =
[Incoming Return Item Detail].Source
WHERE ((([Incoming Return Item Detail].Date) Between [Start Date] And [End
Date]))
GROUP BY [Incoming Return Item Detail].Type, [Incoming Return Item
Detail].queue, [Queues and Descriptions].[Queue Name], [Incoming Return
Sources].[Source Name]
HAVING ((([Incoming Return Item Detail].Type)=" X937"));

You're Grouping By Type, queue, queue name and source name. You'll therefore
see a subtotal for each change in any one of these fields. If you just want to
group by [Queue name] just put that field in the Group By clause.

Since I don't know the meanings or the values of these fields it's hard for me
to provide more details.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top