| От | Joe Conway |
|---|---|
| Тема | Re: Can SQL return a threaded-comment-view result set? |
| Дата | |
| Msg-id | 3F7C42F3.9000102@joeconway.com обсуждение исходный текст |
| Ответ на | Re: Can SQL return a threaded-comment-view result set? (Tom Lane <tgl@sss.pgh.pa.us>) |
| Список | pgsql-novice |
Tom Lane wrote: > mvppetlab@yahoo.com (Chris) writes: >>My question is: is it possible to use pure SQL to return a result set >>that would make rendering a threaded view like the above really easy? > > What you're really after is a tree structure. This is relatively easy > to do with Oracle's CONNECT BY or SQL99's WITH, neither of which we have > in Postgres (yet). I think in bog-standard SQL92 you can't readily do > it without adding some additional fields to the table. > > I highly recommend you buy a copy of Joe Celko's "SQL For Smarties". > He has two whole chapters on different ways to handle trees in SQL. In the short term, if you don't mind a Postgres specific answer, you could also take a look at contrib/tablefunc for a function called connectby(). HTH, Joe
В списке pgsql-novice по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера