sql 条件处理
时间:2010-12-13 来源:Benny Ng
SET @Service_Id = 2
SELECT TOP 1000 service_id,* FROM dbo.MgtRpt_Inspected_Order
WHERE 1=1
AND CASE WHEN @Service_Id=-1 THEN -1 ELSE Service_Id END = @Service_Id
ORDER BY tran_ser_id DESC
相关阅读 更多 +
时间:2010-12-13 来源:Benny Ng
SET @Service_Id = 2
SELECT TOP 1000 service_id,* FROM dbo.MgtRpt_Inspected_Order
WHERE 1=1
AND CASE WHEN @Service_Id=-1 THEN -1 ELSE Service_Id END = @Service_Id
ORDER BY tran_ser_id DESC