请帮助解决此问题,这里是sql fiddler:http://sqlfiddle.com/#!2/8acc1/1
SELECT DISTINCT c.id, v.sel_category,c.curr_tittle , c.curr_desc, v.videos_desc
FROM wp_curriculum c, wp_career_vidoes v
WHERE c.id IN
(SELECT DISTINCT curr_id
FROM wp_curriculum_category
WHERE curr_category IN (2,3)) AS I
AND I.curr_category = v.sel_category
GROUP BY I.curr_category
答案 0 :(得分:3)
SELECT DISTINCT c.id,
v.sel_category,
c.curr_tittle ,
c.curr_desc,
v.videos_desc
FROM wp_curriculum c
INNER JOIN wp_curriculum_category cat
ON c.id = cat.curr_id
INNER JOIN wp_career_vidoes v
ON v.sel_category = cat.curr_category
WHERE cat.curr_category IN (2,3)
要进一步了解联接,请访问以下链接: