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. Massimo suggested that I add the id of the second table using "|". However, then I can't get the result I need, which is grouping by the id of the first table only. I hope this makes sense.
On Tue, Sep 3, 2013 at 10:24 AM, Niphlod <niph...@gmail.com> wrote: > you have a problem with what you want and what you get.... > > Assuming a table > id name surname > 1 tywin lannister > 2 tyrion lannister > 3 eddard stark > 4 sansa stark > > and a query where you want to know how many members of the Game Of Thrones > families you have, you'll likely want to issue a > > select count(*), surname from table group by surname > > the resultset will be > > count(*) surname > 2 lannister > 2 stark > > > > now..... you can't even think to "order" by id, because there is no id at > all included in your resultset ^_^ > > -- > > --- > You received this message because you are subscribed to a topic in the > Google Groups "web2py-users" group. > To unsubscribe from this topic, visit > https://groups.google.com/d/topic/web2py/wWdowJGAs7I/unsubscribe. > To unsubscribe from this group and all its topics, send an email to > web2py+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/groups/opt_out. > -- http://bouguerra.org -- --- 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 web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.