/[webpac2]/branches/Sack/sql/tree-views.sql
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Contents of /branches/Sack/sql/tree-views.sql

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1310 - (show annotations)
Mon Sep 21 19:04:14 2009 UTC (14 years, 7 months ago) by dpavlin
File size: 662 byte(s)
branch for refactoring of WebPAC::Input::* modules for Sack

1 -- items in each topic
2 SELECT item, topic FROM it;
3
4
5 -- topic path for each topic
6 select name, get_topic_path( id ) from topics;
7
8
9 -- topic path for each item
10 select item_id, item_name, get_topic_path(topic_id) from it;
11
12 --
13 -- Select the parent nodes of a topic.
14 -- The parameter to get_topic_node must be hardcoded here.
15 -- The result tuples are ORDERED
16 --
17 SELECT t.name AS base_topic, tn_id , t2.name
18 FROM topics t, get_topic_node(11) g, topics t2
19 WHERE t.id = 11 AND t2.id = g.tn_id;
20
21
22 -- returns items...
23 SELECT it.item_id, i.name as item, it.topic_id, t.name as topic
24 FROM items i, topics t, item_path() it
25 WHERE it.item_id = i.id AND it.topic_id = t.id;
26

  ViewVC Help
Powered by ViewVC 1.1.26