View Single Post

   
  #1 (permalink)  
Old 02-28-2008, 09:26 AM
Bob Bedford
 
Posts: n/a
Default group by problem

Hi all, on a query I've this result:
69 86
77 84
112 91
114 91
119 91
124 92
125 92
133 93
....

first is the idfolder, second is the idclient.

Now When I do a group by idfolder, I've a total of 77 rows (see the result
above for the first part). If I do a group by idclient, then I only get 3
results

Why ? Have you an idea ?

Here is the query:
select folder.idfolder, folder.idclient from folderstatus
inner join statustype on folderstatus.idstatustype=statustype.idstatus
inner join folder on folderstatus.iddossier = folder.idfolder
group by folder.idfolder
having max(idstatustype) = (select idstatus from statustype where
statustype.name like '%search%' limit 0,1)

if I do a group by folder.idclient, then I only get 3 rows instead of about
50.

Bob



Reply With Quote