hallo....
durch diese abfrage bekomm ich den kompletten navigationsbaum angezeigt.
nun möchte ich gern noch ne abfrage machen, die mir nur die punkte bringt, die noch KEINEN direkten unterpunkt haben. (hier z.Bsp punkt C oder L)
meine tabelle ist die hier:
durch diese abfrage bekomm ich den kompletten navigationsbaum angezeigt.
Code:
SELECT pages1.lft AS L, pages1.rgt AS R, CONCAT(REPEAT(' .', COUNT(*) ), pages1.payload) AS Baum , pages1.node_id AS mid, COUNT(*) AS level FROM node AS pages1, node AS pages2 WHERE pages1.lft BETWEEN pages2.lft AND pages2.rgt GROUP BY pages1.lft
meine tabelle ist die hier:
Code:
CREATE TABLE node ( node_id int(10) unsigned NOT NULL auto_increment, root_id int(10) unsigned NOT NULL default '0', payload varchar(64) default NULL, lft int(10) unsigned NOT NULL default '0', rgt int(10) unsigned NOT NULL default '0', PRIMARY KEY (node_id) ) TYPE=MyISAM; # # Dumping data for table 'node' # INSERT INTO node VALUES("1", "1", "Root", "1", "34"); INSERT INTO node VALUES("7", "1", "G", "15", "18"); INSERT INTO node VALUES("2", "1", "B", "2", "13"); INSERT INTO node VALUES("3", "1", "C", "5", "6"); INSERT INTO node VALUES("4", "1", "D", "9", "12"); INSERT INTO node VALUES("5", "1", "E", "10", "11"); INSERT INTO node VALUES("6", "1", "F", "14", "31"); INSERT INTO node VALUES("8", "1", "UU", "16", "17"); INSERT INTO node VALUES("9", "1", "H", "19", "30"); INSERT INTO node VALUES("10", "1", "I", "20", "27"); INSERT INTO node VALUES("11", "1", "J", "21", "24"); INSERT INTO node VALUES("12", "1", "K", "22", "23"); INSERT INTO node VALUES("13", "1", "L", "25", "26"); INSERT INTO node VALUES("14", "1", "M", "28", "29"); INSERT INTO node VALUES("15", "1", "neuer menupunkt", "32", "33"); INSERT INTO node VALUES("16", "1", "linkz", "3", "4"); INSERT INTO node VALUES("17", "1", "rechts von C", "7", "8");
EDIT:
[code]-tags by Abraxax
Kommentar