我有一个查询,它会在到达日期字段后 1 到 28 天产生随机出发日期:
--Query--
SELECT ArrivalDate, DATEADD(day, 1 + RAND(checksum(NEWID()))
* LengthOfStay.LengthofStay, ArrivalDate) AS DepartureDate
FROM Bookings, LengthOfStay
但是,当我运行更新查询时,随机时间减少到 1 或 2 天,谁能告诉我这是为什么?
--Update Statement--
USE Occupancy
Update B
Set DepartureDate = DATEADD(day, 1 + RAND(checksum(NEWID()))*1.5 * L.LengthofStay, B.ArrivalDate)
FROM LengthOfStay L, Bookings B
谢谢
韦恩