SELECT eq.id,eq.ques_name,eq.create_time,eq.sett_status,eq.ques_status,eq.ques_type,eq.prim_diff, eq.corr_diff,eq.default_score,eq.ques_code,eq.paper_count,eq.right_count,eq.search_keyword FROM exam_know_id eq2 LEFT JOIN exam_question eq on eq2.question_id=eq.id WHERE eq2.knowledge_name=‘数组’
SELECT eq.id,eq.ques_name,eq.create_time,eq.sett_status,eq.ques_status,eq.ques_type,eq.prim_diff, eq.corr_diff,eq.default_score,eq.ques_code,eq.paper_count,eq.right_count,eq.search_keyword FROM exam_question as eq LEFT JOIN test_paper_question as eq1 on eq.id=eq1.question_id WHERE eq1.paper_id =25
本人想把这两句合成一句,应该怎么修改呀?
SELECT eq.id,eq.ques_name,eq.create_time,eq.sett_status,eq.ques_status,eq.ques_type,eq.prim_diff, eq.corr_diff,eq.default_score,eq.ques_code,eq.paper_count,eq.right_count,eq.search_keyword FROM exam_question as eq LEFT JOIN test_paper_question as eq1 on eq.id=eq1.question_id WHERE eq1.paper_id =25
本人想把这两句合成一句,应该怎么修改呀?
解决方案
5
合到一起?UNION?INTERSECT?
5
参考:
SQL UNION 和 UNION ALL 操作符 http://www.w3school.com.cn/sql/sql_union.asp
SQL UNION 和 UNION ALL 操作符 http://www.w3school.com.cn/sql/sql_union.asp
5
3张表联合查询撒
25
SELECT eq.id,eq.ques_name,eq.create_time,eq.sett_status,eq.ques_status, eq.ques_type,eq.prim_diff, eq.corr_diff,eq.default_score,eq.ques_code, eq.paper_count,eq.right_count,eq.search_keyword FROM exam_know_id eq2 LEFT JOIN exam_question eq on eq2.question_id=eq.id LEFT JOIN test_paper_question eq1 on eq2.id = eq1.question_id WHERE eq2.knowledge_name="数组" and eq1.paper_id =25