LIMIT between some column
От | Uros Gruber |
---|---|
Тема | LIMIT between some column |
Дата | |
Msg-id | 9218284842.20020519163012@sir-mag.com обсуждение исходный текст |
Ответы |
Re: LIMIT between some column
|
Список | pgsql-general |
Hi! My query is SELECT id_category,name FROM categories WHERE level BETWEEN 1 AND 2 AND lft>1 AND rgt<100 AND active=true ORDER BY name This is about 30 or more records. This records can be grouped by id_parent. What i want to do is limit data in a way that i could get for example only 3 or 4 records with same id_parent. here is some data for explanation. id | parent | 0 | | 1 | 0 | 2 | 0 | 3 | 0 | 4 | 0 | 5 | 1 | 6 | 1 | 7 | 1 | 8 | 1 | 9 | 2 | 10 | 2 | 11 | 3 | 12 | 4 | 13 | 4 | 14 | 4 | 15 | 4 | 16 | 4 | When i execute my query i get all ids from 5 to 16, but i want it to limit somehow that i get only ids, 5,6,7,9,10,11,12,13,14. I hope my problem is understandable. Do I have to use join on table itself or how. -- lp, Uros mailto:uros@sir-mag.com
В списке pgsql-general по дате отправления: