On Sat, Jul 29, 2006 at 03:37:15AM +0300, Tzahi Fadida wrote:
> Hi,
> I have a query i am having trouble to formulate:
> I used to do:
> SELECT DISTINCT a0,a1 FROM public.t1
> However, now i need to add the CTID attribute, but CTID is unique
> thus, distinct is useless. In addition, i can't seem to be able to use max()
> etc... or casting to anything on CTID in order to use group by technique.
Use DISTINCT ON, see the docs for details.
http://www.postgresql.org/docs/7.4/s...ect-lists.html
That's for an older version, but it still works the same, google isn't
delivering the newer version...
Have an nice day,
--
Martijn van Oosterhout <kleptog@svana.org>
http://svana.org/kleptog/
> From each according to his ability. To each according to his ability to litigate.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)
iD8DBQFEy4wDIB7bNG8LQkwRAl7bAJ9pC/KKqZQQA0RTpxtVtmVcgdEqkwCcCHya
6L56yr5Mp/q4EehEWVTuPbk=
=nwMs
-----END PGP SIGNATURE-----