Re: speedest way to handle a select table1,count(table2) where table1.idtable1=table2.idtable1 ? "Captain Paralytic" <paul_lautman@yahoo.com> a écrit dans le message de
news:1181810746.693039.245080@z28g2000prd.googlegr oups.com...
> On 14 Jun, 09:36, "patrice" <patrice_labracherie_nos...@free.fr>
> wrote:
> > Hello
> >
> > I have a list of item in TABLE1, and a list of sub item in TABLE2
> > each item of TABLE1 can have 0 or more sub item
> >
> > i need a query :
> > select TABLE1.x, count( TABLE2.subitem)
> >
> > i guess the natural way should a TABLE1 left outer join TABLE2 with a
> > count(*) and a group by TABLE1.*
> > but i dont like the "group by table1.* "
> Why don't you like this?
> Why would you group by table1.* when you are querying table1.x?
oops, i just this :
select TABLE1.* ,count(TABLE2.IDT2) from TABLE1 left outer join TABLE2 using
(IDT1) group by TABLE1.IDT1
and it works
i dont know why, but i was thinking that you need to use all select column
in the group by |