任何人都可以解釋如何存在聯合工作?我的代碼如下。MS SQL:如果工會內部工作如果存在條件?
if exists(select top 1 ShoppingCartNo from tbSupplierLineItem
where BidSummaryDueDate>CONVERT(date,getdate()) and [email protected]
union
select top 1 ShoppingCartNo from Protrac_Archieve.dbo.tbSupplierLineItem
where BidSummaryDueDate>CONVERT(date,getdate()) and [email protected])
begin
SQL statements
end
它的工作方式與沒有if if一樣 – Jens
基本上用不同的方法寫if if exists()或exists()begin; ...'儘管我認爲'union'應該是'union all'以避免排序操作符(除非已經通過在exists()中進行了優化) – SqlZim
爲什麼你認爲它可以工作在這方面? –