What about replacing the table by
SELECT * FROM my_table ORDER BY num
i.e. something like
SELECT cat, LAST(id), LAST(num) FROM (SELECT * FROM my_table ORDER BY num)
AS foo GROUP_BY cat;
Hope it works, just guessing it might help :-)
regards
Tomas
> SELECT cat, MAX(num) FROM my_table GROUP_BY
rg
Subject: Re: [SQL] Subsorting GROUP BY data
> -Mensaje original-
> De: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] En nombre de Johnson, Michael
> L.
> Enviado el: Lunes, 10 de Noviembre de 2008 12:57
> Para: pgsql-sql@postgresql.org
> Asunto: [SQL] Subsorti
> -Mensaje original-
> De: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] En nombre de Johnson,
> Michael L.
> Enviado el: Lunes, 10 de Noviembre de 2008 12:57
> Para: pgsql-sql@postgresql.org
> Asunto: [SQL] Subsorting GROUP BY data
>
> Given the follo
what you need (with minor fixes...)
Best,
Oliveiros
- Original Message -
From: "Johnson, Michael L." <[EMAIL PROTECTED]>
To:
Sent: Monday, November 10, 2008 2:56 PM
Subject: [SQL] Subsorting GROUP BY data
Given the following table:
ID | Cat | Num
|---|---
Given the following table:
ID | Cat | Num
|---|--
Z | A | 0
Y | A | 1
X | A | 2
W | B | 0
V | B | 1
U | B | 2
T | C | 0
S | C | 1
R | C | 2
I want to do this: Group the items by the cat field. Then select th