Re: 7.0 weirdness

Peter Vazsonyi <neko@kredit.sth.szif.hu>

From: Peter Vazsonyi <neko@kredit.sth.szif.hu>
To: Jeff MacDonald <jeff@pgsql.com>
Cc: pgsql-sql@postgresql.org, pgsql-hackers@postgresql.org
Date: 2000-05-31T06:45:08Z
Lists: pgsql-hackers
Hi Jeff!

I think you need a solution, and not explains...
Tom, and the others told the truth. You missed this query.

> gid is unique.. it's a serial..
I give you two ways:

1) gid __realy__ unique  ->  DISTINCT is unnecessary.
 SELECT gid FROM members -- ... etc 

2) gid not unique  ->  DISTINCT is not enough. ;(
 SELECT gid,MAX(created) -- or MIN or AVG ... any aggregate
	FROM members -- ... etc
 GROUP BY gid ORDER BY 2; -- second colunm

> > >gm=> SELECT DISTINCT gid FROM members
> > >gm-> WHERE active = 't'
> > >gm-> AND  (gender = 0
> > >gm->         AND  (wantrstypemale LIKE '%Short Term%'
> > >gm->                 OR wantrstypemale like '%Marriage%'
> > >gm->                 OR wantrstypemale like '%Long Term%'
> > >gm->                 OR wantrstypemale like '%Penpal%'
> > >gm->                 OR wantrstypemale like '%Activity Partner%')
> > >gm-> )  order by created desc;
> > >ERROR:  For SELECT DISTINCT, ORDER BY expressions must appear in target 

best regards
--
 nek;(