| От | Artacus |
|---|---|
| Тема | Re: Getting rows in a very specific order |
| Дата | |
| Msg-id | 48CB7DF3.8070700@comcast.net обсуждение исходный текст |
| Ответ на | Getting rows in a very specific order (Gordon <gordon.mcvey@ntlworld.com>) |
| Список | pgsql-general |
> If I use the value of the hierarchy column in a query I can get all > the rows that a given row is an descendant of. (SELECT * FROM items > WHERE itm_id IN (1,31,68,97), for example. However, I need the rows > to be in the correct order, ie the root node first, child second, > grandchild third etc. I'm guessing the order can be set with an ORDER > BY, but I've only ever used ORDER BY to order by ascending or > descending order of a single column. Is there a way to retrieve the > rows explicitly in the order they are listed in the hierarchy array? If you've got the intarray contrib module installed, you can use idx(array[1,31,68,97], i)
В списке pgsql-general по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера