如何在sql server中并行合并两个查询 [英] how to merge two query in parallel in sql server
本文介绍了如何在sql server中并行合并两个查询的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想将两个查询数据合并为一个,第二个查询应该并行合并
SELECT ccew.cce_weightages_Id,ccew.Weightages,Criteria_Type,ccecat.ExamCat_Name from tbl_CceWeightage ccew 内部 join tbl_CceExamCategory ccecat on ccecat.CceExamCat_Id = ccew.CceExamCat_Id
选择 cwc.Course_Id 来自 tbl_CceWeightagesCourse cwc 其中 cwc.cce_weightages_Id in ( select we.cce_weightages_Id 从 tbl_CceWeightage我们)
Course_Id列输出与第一个查询输出合并。
plz help我。
解决方案
如果你想加入数据,请看:
SELECT ccew.cce_weightages_Id ,ccew.Weightages,Criteria_Type,ccecat.ExamCat_Name, cwc.Course_Id
FROM tbl_CceWeightage ccew
INNER JOIN tbl_CceExamCategory ccecat ON ccecat.CceExamCat_Id = ccew.CceExamCat_Id
INNER JOIN tbl_CceWeightage cwc ON cwc.cce_weightages_Id = ccew.cce_weightages_Id
< pre lang =SQL> SELECT ccew.cce_weightages_Id,ccew.Weightages,Criteria_Type,ccecat.ExamCat_Name
FROM tbl_CceWeightage ccew
INNER JOIN tbl_CceExamCategory ccecat ON ccecat.CceExamCat_Id = ccew.CceExamCat_Id
WHERE ccew.cce_weightages_Id NOT IN ( SELECT cce_weightages_Id FROM tbl_CceWeightage)
[/ EDIT]
我建议阅读我的第一篇SQL文章这里 [ ^ ],它解释了什么是连接。
i want to merge two query data into one ,and the second query should be merge in parallel
SELECT ccew.cce_weightages_Id,ccew.Weightages,Criteria_Type,ccecat.ExamCat_Name from tbl_CceWeightage ccew inner join tbl_CceExamCategory ccecat on ccecat.CceExamCat_Id=ccew.CceExamCat_Id
select cwc.Course_Id from tbl_CceWeightagesCourse cwc where cwc.cce_weightages_Id in(select we.cce_weightages_Id from tbl_CceWeightage we)
Course_Id column output merge with first query output.
plz help me .
解决方案
If you want to join data, please see this:
SELECT ccew.cce_weightages_Id,ccew.Weightages,Criteria_Type,ccecat.ExamCat_Name, cwc.Course_Id FROM tbl_CceWeightage ccew INNER JOIN tbl_CceExamCategory ccecat ON ccecat.CceExamCat_Id=ccew.CceExamCat_Id INNER JOIN tbl_CceWeightage cwc ON cwc.cce_weightages_Id = ccew.cce_weightages_Id
[EDIT]
SELECT ccew.cce_weightages_Id,ccew.Weightages,Criteria_Type,ccecat.ExamCat_Name FROM tbl_CceWeightage ccew INNER JOIN tbl_CceExamCategory ccecat ON ccecat.CceExamCat_Id=ccew.CceExamCat_Id WHERE ccew.cce_weightages_Id NOT IN (SELECT cce_weightages_Id FROM tbl_CceWeightage)
[/EDIT]
I suggest reading my first SQL article here[^], which explains what joins are.
这篇关于如何在sql server中并行合并两个查询的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文