モロ屋

アキバではたらくWebエンジニア。JavaScript / AWS / Mac

MySQL JOIN

一番いいのはどれかな?(多分一番下

SELECT
    *
FROM
    `contents` AS `t0`
    LEFT JOIN
        `header` AS `t1`
    ON  (
            `t0`.`id` = `t1`.`id`
        AND `t1`.`deleted_at` IS NULL
        )
WHERE
    `t0`.`deleted_at` IS NULL
LIMIT 100;
SELECT
    *
FROM
    `contents` AS `t0`
    LEFT JOIN
        `header` AS `t1`
    ON  (
            `t0`.`id` = `t1`.`id`
        )
WHERE
    `t0`.`deleted_at` IS NULL
AND `t1`.`deleted_at` IS NULL
LIMIT 100;
SELECT *
FROM `contents` AS `t0`
JOIN `header` AS `t1`
WHERE `t0`.`id` = `t1`.`id`
AND `t0`.`deleted_at` IS NULL
AND `t1`.`deleted_at` IS NULL
LIMIT 100;

それにしても、やっぱIS NULLってあんまお行儀良くないよね。。

広告を非表示にする