我是 T SQL 的新手,我有两个查询需要根据公共列值组合它们。两个查询都单独工作正常。
第一个查询是
SELECT t_senderTable.nameFull AS "senderName", t_recieverTable.recieverName AS "recieverName"
FROM ((dbo.t_senderTable AS t_senderTable
INNER JOIN t_senderTable AS t_senderTable ON (t_senderTable.Kd = mapTable.senderID))
INNER JOIN t_recieverTable AS t_recieverTabler ON (recieverTable.Id = mapTable.recieverID )
第二个查询是
SELECT t_license AS "License", t_coName AS "Company Name"
FROM (dbo.t_license AS t_license
INNER JOIN dbo. t_coName ON ( t_coName.id = t_license.senderID ))
WHERE
(
t_license.check < '2' )
基本上我需要组合这两个查询,以便使用两个查询之间通用的 senderID,我得到 senderName、recieverName 和 coName senderID 的输出结果是一对多的关系。从这篇文章中得到想法,但无法让它工作结合 SQL Server 查询 有什么想法如何去做吗?谢谢