简体   繁体   中英

How to subtract two temporary union tables column?

I have Four Temp table :

I want count of this Two temp temp table

(#OneyearExpiry + #OtherYearExpiry) as A

(#ONEYRCON+#OTHERYRCON) As B

And then need to subtract AB

can anybody help me into that ?

Thanks in advance :)

How about using except

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

except

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM