alex: leere zeile und nur null-werte..wieso?? brauche nen rat

Beitrag lesen

hallo.....

wenn ich als id wie hier im beispiel 143 eingebe erhalte ich als erste
tabellenzeile immer ne zeile wo alle spalten null sind.
ich weis auch nicht mehr weiter.
Vielleicht kann mir jemand sagen warum

hier ist meine abfrage:

SELECT m2.menu_id, m2.sort, m2.parent_id, m2.name
    FROM  n_menu m
    LEFT JOIN menu_has_menu mm
        ON  ( m.menu_id = mm.child_id )
    LEFT JOIN n_menu m2
        ON ( mm.menu_id = m2.parent_id )
    LEFT JOIN menu_has_menu mm2
        ON ( m2.menu_id = mm2.child_id )
    WHERE m.menu_id = '143' or m.parent_id = '143'
    GROUP BY m2.menu_id, m2.parent_id, m2.sort
    ORDER BY m2.parent_id,  m2.sort

und das sind die tabellen dazu:

Table structure for table 'menu_has_menu'

CREATE TABLE menu_has_menu (
  menu_id int(10) unsigned NOT NULL default '0',
  child_id int(10) unsigned NOT NULL default '0',
  PRIMARY KEY  (menu_id,child_id)
) TYPE=MyISAM;

Dumping data for table 'menu_has_menu'

INSERT INTO menu_has_menu VALUES("0", "137");
INSERT INTO menu_has_menu VALUES("0", "138");
INSERT INTO menu_has_menu VALUES("0", "139");
INSERT INTO menu_has_menu VALUES("0", "140");
INSERT INTO menu_has_menu VALUES("0", "141");
INSERT INTO menu_has_menu VALUES("0", "142");
INSERT INTO menu_has_menu VALUES("0", "144");
INSERT INTO menu_has_menu VALUES("0", "145");
INSERT INTO menu_has_menu VALUES("0", "146");
INSERT INTO menu_has_menu VALUES("0", "147");
INSERT INTO menu_has_menu VALUES("138", "139");
INSERT INTO menu_has_menu VALUES("138", "140");
INSERT INTO menu_has_menu VALUES("138", "141");
INSERT INTO menu_has_menu VALUES("138", "142");
INSERT INTO menu_has_menu VALUES("138", "147");
INSERT INTO menu_has_menu VALUES("140", "141");
INSERT INTO menu_has_menu VALUES("140", "142");
INSERT INTO menu_has_menu VALUES("143", "144");
INSERT INTO menu_has_menu VALUES("143", "145");
INSERT INTO menu_has_menu VALUES("143", "146");
INSERT INTO menu_has_menu VALUES("144", "145");

Table structure for table 'n_menu'

CREATE TABLE n_menu (
  menu_id int(10) unsigned NOT NULL auto_increment,
  parent_id int(10) unsigned NOT NULL default '0',
  name varchar(255) NOT NULL default '',
  sort int(10) unsigned NOT NULL default '0',
  PRIMARY KEY  (menu_id)
) TYPE=MyISAM;

Dumping data for table 'n_menu'

INSERT INTO n_menu VALUES("137", "0", "Oberpunkt 1", "1");
INSERT INTO n_menu VALUES("138", "0", "Oberpunkt 2", "2");
INSERT INTO n_menu VALUES("139", "138", "U1_OP 2", "1");
INSERT INTO n_menu VALUES("140", "138", "U2_OP 2", "2");
INSERT INTO n_menu VALUES("141", "140", "U21_OP 2", "1");
INSERT INTO n_menu VALUES("142", "140", "U22_OP 2", "2");
INSERT INTO n_menu VALUES("143", "0", "Oberpunkt 3", "3");
INSERT INTO n_menu VALUES("144", "143", "U1_OP 3", "1");
INSERT INTO n_menu VALUES("145", "144", "U11_OP 3", "1");
INSERT INTO n_menu VALUES("146", "143", "U2_OP 3", "2");
INSERT INTO n_menu VALUES("147", "138", "U3_OP 2", "3");