rustyroo
asked on
Distinct Count in Access 2007
Hey guys,
Need to count distinct invoice numbers in the below query. Have tried lots of ways to no effect... can someone please assist.
thanks
Rusty
SELECT [Working-rep+acc].[Sales Rep], Count ([Working-rep+acc].[Invoic e Number]) AS [CountOfInvoice Number]
FROM [Working-rep+acc]
GROUP BY [Working-rep+acc].[Sales Rep];
Need to count distinct invoice numbers in the below query. Have tried lots of ways to no effect... can someone please assist.
thanks
Rusty
SELECT [Working-rep+acc].[Sales Rep], Count ([Working-rep+acc].[Invoic
FROM [Working-rep+acc]
GROUP BY [Working-rep+acc].[Sales Rep];
in access you should use sub-query for your select that contains the distinct select
something like
SELECT t.[Sales Rep], Count (t.[Invoice Number]) AS [CountOfInvoice Number]
FROM (
SELECT distinct [Working-rep+acc].[Sales Rep], [Working-rep+acc].[Invoice Number]) AS t
GROUP BY [Working-rep+acc].[Sales Rep];
something like
SELECT t.[Sales Rep], Count (t.[Invoice Number]) AS [CountOfInvoice Number]
FROM (
SELECT distinct [Working-rep+acc].[Sales Rep], [Working-rep+acc].[Invoice
GROUP BY [Working-rep+acc].[Sales Rep];
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
worked great thanks
SELECT [Working-rep+acc].[Sales Rep], [Working-rep+acc].[Invoice
FROM [Working-rep+acc]
GROUP BY [Working-rep+acc].[Sales Rep], [Working-rep+acc].[Invoice