开发者

SQL Server query error: "Missing or incomplete select statement"

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜