From: | Frank Bax <fbax(at)sympatico(dot)ca> |
---|---|
To: | John Taylor <postgres(at)jtresponse(dot)co(dot)uk> |
Cc: | pgsql-novice(at)postgresql(dot)org |
Subject: | Re: problem query ... |
Date: | 2002-01-31 17:35:40 |
Message-ID: | 3.0.6.32.20020131123540.01b78ba0@pop6.sympatico.ca |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-novice |
select mytable.* from mytable, (select id,max(update) as update from
mytable group by id) maxes where mytable.id = maxes.id and mytable.update =
maxes.update;
At 04:24 PM 1/31/02 +0000, John Taylor wrote:
>
>Hi,
>
>I hope someone can help with this query, which is causing me great problems.
>
>I have a table:
>create table mytable ( id varchar(10), name varchar(10), desc varchar(10),
update integer);
>
>I want to return 1 row for each id, that contains the maximum update value
for that id, and
>the values for name and desc.
>
>I've tried everything I can think of, but no luck :-(
>I'm sure there is some simple trick that I'm missing.
>
>Can someone please put me out of my misery !
>
>Thanks
>JohnT
>
>---------------------------(end of broadcast)---------------------------
>TIP 2: you can get off all lists at once with the unregister command
> (send "unregister YourEmailAddressHere" to majordomo(at)postgresql(dot)org)
>
From | Date | Subject | |
---|---|---|---|
Next Message | John Taylor | 2002-01-31 17:47:21 | Re: problem query ... |
Previous Message | John Taylor | 2002-01-31 17:08:29 | Re: problem query ... |