取消了我原来的问题,因为这可能是一个更清晰的版本!
这就是我想要做的。目前,我得到 *'当 EXISTS 未引入子查询时,选择列表中只能指定一个表达式。强调文字*
declare @X int
SET @X=(
SELECT B.ID,
Case
When Getdate() Between '2012-11-01 00:00' AND '2013-10-31 23:59' then 731
When Getdate() Between '2012-11-01 00:00' AND '2013-10-31 23:59' then 1096
END FROM Booking B)
Select
B.Created - @X AS 'Bookings date less X'
From Booking B