COUNT without group by, possible

User avatar
sal21
PlatinumLounger
Posts: 4368
Joined: 26 Apr 2010, 17:36

COUNT without group by, possible

Post by sal21 »

Code: Select all

    SQL = "SELECT PRE.TIT, PRE.N, PRE.CF, PRE.S, PRE.A, Count(PRE.CA) AS ConteggioDiCA" & _
          " From PRE" & _
          " WHERE Not (PRE.S) Is Null AND PRE.A>=#" & Format(minDate, "MM/DD/YYYY") & "# AND PRE.ID IN('CM','CN')"
have error?

But really to count i need to group y or not?

User avatar
HansV
Administrator
Posts: 78620
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: COUNT without group by, possible

Post by HansV »

No, that won't work. If you don't group by TIT, N, CF, S and A, the count for every record would be 1.

What do you want to accomplish?
Best wishes,
Hans