maybe this way: select min(id), count(*), surname from table group by surname
? On Tuesday, September 3, 2013 5:43:42 AM UTC-7, Johann Spies wrote: > > On 3 September 2013 11:42, Bassem Bouguerra <[email protected]<javascript:> > > wrote: > >> I am sorry. I am trying to groupby and not orderby. >> I want to select from 2 tables and groupby the id of one table. This >> works fine in sqllight but throws an error on postgresql. >> >> You cannot do that in Postgresql. If you want to group by in Postresql > you have to use all the fields in the groupby part that was used in the > 'select' part of the query. > > Regards > Johann > -- --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/groups/opt_out.

