ERROR: for SELECT DISTINCT, ORDER BY expressions must appear in select list

From: "sergey kapustin" <master(dot)sergey(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: ERROR: for SELECT DISTINCT, ORDER BY expressions must appear in select list
Date: 2006-06-07 15:09:09
Message-ID: cf82f1380606070809n55e211f5sddd671dfd8bb487d@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi all!
can anybody say me what's wrong with this query. I just try to take
unique values from table column and print them in random order

select distinct num from (select 1 as num union select 2 as num union
select 1 as num union select 3) t order by random();
ERROR: for SELECT DISTINCT, ORDER BY expressions must appear in select list

thank you

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Jessica M Salmon 2006-06-07 15:37:10 Re: composite data type question
Previous Message Jonathon McKitrick 2006-06-07 14:44:57 Re: Problem with 'postgres' db with 8.0 on a MacBook