1

I am working in a table in SQL and attempting to get the distinct counts of transaction numbers for each retailer during certain days in my dataset. Right now this is what I have:

SELECT COUNT (*), pos_table.Retailer

FROM pos_table

WHERE Month(Timestamp) = 3 AND Day(Timestamp) = 3 OR Day(Timestamp) = 4

Group By Retailer

This gives me the counts for each retailer but when I add "COUNT (DISTINCT pos_table.Transaction) in place of COUNT (*) it does not run.

Jaydip Rakholiya
  • 792
  • 10
  • 20

1 Answers1

1

Access didn't support count(distinct [colunm]) you can try to write a subquery to make it.

select COUNT(t1.Transaction),t1.Retailer
from (
    SELECT DISTINCT t1.Transaction,t1.Retailer
    FROM pos_table AS t1
    WHERE Month(t1.Timestamp) = 3 AND Day(t1.Timestamp) = 3 OR Day(t1.Timestamp) = 4
) AS t1
GROUP BY t1.Retailer
D-Shih
  • 44,943
  • 6
  • 31
  • 51