SQL查询语句如何合并结果

如图:我分两次查询出软件信息,如何合并查询条件,一次性查询出软件信息,请高手指教。select [TPADEA].DEA002 as 主物料名称,[TPADEA].DEA001 as 主物料编号,[TPADEA].DEA057 as 主物料描述,[SGMQAB].QAB003 as 测试软件from [ZCDZ].[dbo].[SGMQAB],[ZCDZ].[dbo].[TPADEA]where [TPADEA].DEA001=[SGMQAB].QAB001 and [TPADEA].DEA002='M0011-101' and [TPADEA].DEA001 like '1-D%' and [SGMQAB].QAB003 like '6-%'SELECT DEA001 as 测试软件,DEA002 as 软件名称,DEA057 as 软件描述,DEA036 as 软件版本 FROM [ZCDZ].[dbo].[TPADEA] where DEA001='6-S01-151393-01'

用union all

select *
from (
select [TPADEA].DEA002 as 主物料名称,[TPADEA].DEA001 as 主物料编号,
[TPADEA].DEA057 as 主物料描述,[SGMQAB].QAB003 as 测试软件
from [ZCDZ].[dbo].[SGMQAB],[ZCDZ].[dbo].[TPADEA]

union all

SELECT DEA001 as 测试软件,DEA002 as 软件名称,DEA057 as 软件描述,
DEA036 as 软件版本
FROM [ZCDZ].[dbo].[TPADEA]
)a where [TPADEA].DEA001=[SGMQAB].QAB001
and [TPADEA].DEA002='M0011-101'
and [TPADEA].DEA001 like '1-D%'
and [SGMQAB].QAB003 like '6-%'
or DEA001='6-S01-151393-01'
大概这种格式,需要以怎样的格式输出再具体变换一下就行了
温馨提示:内容为网友见解,仅供参考
无其他回答
相似回答