| От | Zac |
|---|---|
| Тема | Re: ORDER records based on parameters in IN clause |
| Дата | |
| Msg-id | d9u33p$1ao3$1@news.hub.org обсуждение |
| Ответ на | ORDER records based on parameters in IN clause ("Riya Verghese" <riya.verghese@admissioncorp.com>) |
| Ответы |
Re: ORDER records based on parameters in IN clause
|
| Список | pgsql-sql |
Riya Verghese wrote: > select * from table where id IN (2003,1342,799, 1450) > > I would like the records to be ordered as 2003, 1342, 799, 1450. The > outer query has no knowledge of the count(id) that the inner_query is > ordering by. I think this is the real problem: outer query must know count(id) to order by count(id). You can use it in the outer with something like this: SELECTtable.* FROMtableJOIN (SELECT id, count(id) AS count FROM... your subquery) AS x ORDER BYx.count Bye.
В списке pgsql-sql по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера