Selecting Random Records

Поиск
Список
Период
Сортировка
От shawn everett
Тема Selecting Random Records
Дата
Msg-id Pine.LNX.4.21.0011072224100.21321-100000@alder.pgweb.com
обсуждение исходный текст
Ответ на Re: feature request and scripting question  (KuroiNeko <evpopkov@carrier.kiev.ua>)
Список pgsql-general
I have a database of questions and I would like to be able to pull them
out randomly from the database using  query.

I'm thinking of something along the lines of:

SELECT random() as RND,question
FROM Problems
ORDER BY RND;

Where random() is a user defined or built in function that returns a
random number.

Is this possible?  Is there a better way to do this on the database
side.  I could do it through code in the application, I'd just prefer not
to.

Shawn


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

Предыдущее
От: KuroiNeko
Дата:
Сообщение: Re: feature request and scripting question
Следующее
От: Jan Wieck
Дата:
Сообщение: Re: Is cycle references?