[SQL] Help with query, stuck :(

2005-06-27 Thread bumby
I have a table as Table "public.timereport" Column |Type | Modifiers --+-+ id | integer

Re: [SQL] Help with query involving aggregation and joining.

2003-02-24 Thread Christoph Haller
> > ERROR: > SELECT DISTINCT ON expressions must match > initial ORDER BY expressions may be gotten over by > wrapping the first query result in a subselect. > > not sure though if its proper. > regds > mallah. > > test=# SELECT * from ( SELECT distinct on (a.id) b.id > ,courseid,name,submission

Re: [SQL] Help with query involving aggregation and joining.

2003-02-24 Thread Rajesh Kumar Mallah
ERROR: SELECT DISTINCT ON expressions must match initial ORDER BY expressions may be gotten over by wrapping the first query result in a subselect. not sure though if its proper. regds mallah. test=# SELECT * from ( SELECT distinct on (a.id) b.id ,courseid,name,submission from course a joi

Re: [SQL] Help with query involving aggregation and joining.

2003-02-23 Thread Eddie Cheung
Hi, I was very glad to see the replies from you guys this morning. The two suggested SQL queries did not return the expected results, but will help me to explain the problem I am facing further. 1) Josh suggested the following query. (I have made minor changes by adding the table name to each f

Re: [SQL] Help with query involving aggregation and joining.

2003-02-23 Thread Josh Berkus
Eddie, > My requirements involve several large tables. I have > simplied scenario into the follow two fictional tables > which describes the same requirements. Keep in mind that a simplified example may not solve your real problem ... > Basically I would like to display the latest > submission f

[SQL] help with query

2001-01-24 Thread Oleg Bartunov
Hi, I have a table messages which has (for simplicity) two columns - msg_id, last_id, where last_id is sort of symbolical link - it points to the msg_id of the last version of message. There are no limitation to the number of versions. The problem I have is to get history of message with given