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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SELECT COUNT distinct

Status
Not open for further replies.
Have you tried:
Code:
SELECT CASSA.GIORNO, Count(DISTINCT CASSA.SCONTRINO) AS CONTASCONTRINO
FROM CASSA
WHERE CASSA.ANNULL IS NULL AND CASSA.ANNO='2021' AND CASSA.MESE='8'
GROUP BY CASSA.GIORNO

If that doesn't work, you might try
Code:
SELECT giorno, count(scontrino) 
  FROM (SELECT DISTINCT giorno, scontrino 
          FROM cassa
         WHERE ANNULL IS NULL AND ANNO='2021' AND MESE='8') v;
 
TKS CARP, have you tested?
i'm on Access
 
No, I have not tested this. Since I didn't know what system you were on, it wouldn't have made much difference since I would have tested on Oracle.
But since it should be a simple copy/paste for you, it would be better if you tested it, no?
 
Sal21 - have you tested?
This works on Oracle, but Access may have different results.
 
Carp, with a little modify, and work, tks.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top