Re: 7.0 weirdness

Поиск
Список
Период
Сортировка
От Peter Vazsonyi
Тема Re: 7.0 weirdness
Дата
Msg-id Pine.LNX.4.10.10005310830540.7240-100000@kredit.sth.szif.hu
обсуждение исходный текст
Ответ на Re: 7.0 weirdness  (Jeff MacDonald <jeff@pgsql.com>)
Список pgsql-sql
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 aggregateFROM members
--... etcGROUP 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;(



В списке pgsql-sql по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Re: Pg/PLSQL Errors!!
Следующее
От: Rostislav Opocensky
Дата:
Сообщение: Re: Function-based index not used in a simple query