商品上架时间设计跨天的查询
1 SELECT * 2 FROM C 3 WHERE ( 1 = CASE WHEN c.vcStartTime < c.vcEndTime 4 THEN ( CASE 5 WHEN CONVERT(VARCHAR(5), GETDATE(), 8) BETWEEN c.vcStartTime 6 AND 7 c.vcEndTime 8 THEN 1 9 ELSE 0 10 END ) 11 ELSE ( CASE 12 WHEN CONVERT(VARCHAR(5), GETDATE(), 8) >= c.vcStartTime 13 OR CONVERT(VARCHAR(5), GETDATE(), 8) <= c.vcEndTime 14 THEN 1 15 ELSE 0 16 END ) 17 END )