Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/sql/78.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Sql 如何在列中减去两个临时联合表?_Sql_Tsql - Fatal编程技术网

Sql 如何在列中减去两个临时联合表?

Sql 如何在列中减去两个临时联合表?,sql,tsql,Sql,Tsql,我有四张临时桌: 我要数一数这两张临时表 (#oneyearexpire+#otheryearexpire)作为 (#ONEYRCON+#OTHERYRCON)作为B 然后需要减去A-B 有人能帮我吗 提前感谢:)除了使用 select * from ( select * from #OneyearExpiry union all select * from #OtherYearExpiry ) A except select * from ( select * from #

我有四张临时桌:

我要数一数这两张临时表

(#oneyearexpire+#otheryearexpire)作为

(#ONEYRCON+#OTHERYRCON)作为B

然后需要减去A-B

有人能帮我吗


提前感谢:)

除了使用

select * from
(
  select * from #OneyearExpiry
  union all
  select * from #OtherYearExpiry
) A

except

select * from
(
  select * from #ONEYRCON
  union all
  select * from #OTHERYRCON
) B

使用子查询?我们无法运行上述操作,并且我们这里没有样本数据或预期结果。非常感谢,它实际上按照我的要求工作。请再次询问如何在三个差异表中为两组联合数据和整个查询数据添加数据。