1
讓其他表中的數據我目前正在運行的這條SQLMYSQL在加入
SELECT jm_recipe.name, jm_recipe.slug
FROM jm_recipe
LEFT JOIN jm_category_recipe ON jm_category_recipe.recipe_id = jm_recipe.id
WHERE jm_category_recipe.category_id = $cat"
這將返回不同的是我還需要返回的類別,我要找的配方爲名所期望的結果要做到這一點我想在添加字段到我的SELECT
發言,並添加表到FROM
條款,
SELECT jm_recipe.name, jm_recipe.slug, jm_category_name
FROM jm_recipe, jm_category
LEFT JOIN jm_category_recipe ON jm_category_recipe.recipe_id = jm_recipe.id
WHERE jm_category_recipe.category_id = $cat"
然而這只是不返回任何結果,我究竟做錯了什麼?