Alexander, W.: Mysql, Join oder nicht Join

Beitrag lesen

Hall Guest,

mit Unterabfragen dürfte das noch schneller gehen als  mit JOIN, falls du entsprechend hohe Version von MySQL hast.

Bsp.

SELECT t1.text,
       (SELECT FROM t2 WHERE t1.id_t2 = t2.id) AS text2,
       (SELECT FROM t3 WHERE t2.id_t3 = t3.id) AS text3_1,
       (SELECT FROM t3 WHERE t2.id_t3 = t3.id) AS text3_2,
FROM   t1
WHERE t1.id = $suchindex

Unterabfragen werden von MySQL ab 5 (soweit erinnere) bevorzugt.

Gruß Alexander.