SELECT
Id, Product,
[fare] = CASE WHEN @date BETWEEN s1from AND s1to THEN s1rate ELSE fare
FROM Table1
Error开发者_运维问答:
Missing or incomplete select statement
Haven't you forgot the END keyword at the end of CASE statement?
Ie.
SELECT
Id, Product,
[fare] = CASE WHEN @date BETWEEN s1from AND s1to THEN s1rate ELSE fare END
FROM Table1
Try
SELECT Id, Product, [fare] =
CASE @date
WHEN BETWEEN s1from AND s1to THEN s1rate
ELSE fare
END
FROM Table1
The query might be like this,
Select Id, Product, (case when @date between s1from and s1to then s1rate else fare end)as fare from Table1.
Try this.
精彩评论