|
|
|
Как задать иерархию по двум ветвям?
|
|||
|---|---|---|---|
|
#18+
Допустим, есть таблица Create table Animals (id_Animal number(5) primary key, Mother number(5), Father number(5)); Mother и Father являются первичными ключами животных. Как построить иерархических запрос для просмотра всех родственников по материнской и отцовской ветке? ... |
|||
|
:
Нравится:
Не нравится:
|
|||
| 18.05.2003, 14:27 |
|
||
|
Как задать иерархию по двум ветвям?
|
|||
|---|---|---|---|
|
#18+
This will give you complete hierarchy: Код: plaintext 1. 2. 3. 4. 5. 6. 7. 8. 9. To get all relatives of a specific animal, you would have to combine two queries: ascendants (parents, grandparents, etc.) and descendants (children, grandchildren, etc.): Код: plaintext 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. You can even: Код: plaintext 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. 15. 16. 17. 18. 19. 20. 21. 22. 23. 24. 25. 26. 27. 28. 29. 30. 31. 32. 33. SY ... |
|||
|
:
Нравится:
Не нравится:
|
|||
| 18.05.2003, 19:44 |
|
||
|
Как задать иерархию по двум ветвям?
|
|||
|---|---|---|---|
|
#18+
Sorry, second query is missing keyword PRIOR. It should be: Код: plaintext 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. 15. 16. 17. 18. 19. SY ... |
|||
|
:
Нравится:
Не нравится:
|
|||
| 18.05.2003, 19:49 |
|
||
|
Как задать иерархию по двум ветвям?
|
|||
|---|---|---|---|
|
#18+
All day I had I feeling there was something wrong with the third query I posted. And it just hit me that ORDER BY the way I use it will not work. It should be: Код: plaintext 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. 15. 16. 17. 18. 19. 20. 21. 22. 23. 24. 25. 26. 27. 28. 29. 30. 31. 32. 33. 34. 35. SY ... |
|||
|
:
Нравится:
Не нравится:
|
|||
| 19.05.2003, 03:42 |
|
||
|
|

start [/forum/topic.php?fid=52&msg=32162589&tid=1990506]: |
0ms |
get settings: |
9ms |
get forum list: |
20ms |
check forum access: |
4ms |
check topic access: |
4ms |
track hit: |
181ms |
get topic data: |
13ms |
get forum data: |
3ms |
get page messages: |
58ms |
get tp. blocked users: |
2ms |
| others: | 235ms |
| total: | 529ms |

| 0 / 0 |
