这是我的问题,这些几乎是相同的,直到最后一部分
SELECT Offers.ID
FROM Offers, Products
WHERE Offers.IDProduct = Products.ID
AND Offers.fromDate <= GETDATE()
AND GETDATE() <= Offers.toDate
AND Offers.active = 1
AND Offers.IDHost = 1
AND Offers.ID IN
(SELECT idobject FROM Multilingual
WHERE Multilingual.IDLanguage = 2
AND Multilingual.IDObjecttype = 30
AND Multilingual.active = 1)
第二个查询是
SELECT Offers.ID
FROM Offers, Products
WHERE Offers.IDProduct = Products.ID
AND Offers.fromDate <= GETDATE()
AND GETDATE() <= Offers.toDate
AND Offers.active = 1
AND Offers.IDHost = 1
AND Products.partnerObject = 0
如果第一个查询没有结果,则将执行第二个查询。
有没有办法在一个查询中做到这一点?