Re: [HACKERS] Formulating an sql query with CTID

2006-07-29 Thread Hannu Krosing
Ühel kenal päeval, L, 2006-07-29 kell 18:25, kirjutas Martijn van Oosterhout: > 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 CT

Re: [HACKERS] Formulating an sql query with CTID

2006-07-29 Thread Martijn van Oosterhout
On Sat, Jul 29, 2006 at 01:37:44PM +0300, Tzahi Fadida wrote: > 10x, > Found my answer thanks to Ragnar. > SELECT DISTINCT ON (a0,a1) a0,a1,ctid FROM t1 > > To tell the truth, i did not know there was an ON option in SQL. > This thing is very handy. There isn't, it's a postgresql extension, alb

Re: [HACKERS] Formulating an sql query with CTID

2006-07-29 Thread Martijn van Oosterhout
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

Re: [HACKERS] Formulating an sql query with CTID

2006-07-29 Thread Tzahi Fadida
10x, Found my answer thanks to Ragnar. SELECT DISTINCT ON (a0,a1) a0,a1,ctid FROM t1 To tell the truth, i did not know there was an ON option in SQL. This thing is very handy. On Saturday 29 July 2006 03:37, Tzahi Fadida wrote: > Hi, > I have a query i am having trouble to formulate: > I used t

[HACKERS] Formulating an sql query with CTID

2006-07-28 Thread Tzahi Fadida
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 us