开发者

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

开发者 https://www.devze.com 2023-02-15 07:02 出处:网络
SELECT Id, Product, [fare] = CASE WHEN @date BETWEEN s1from AND s1to THEN s1rate ELSE fare FROM Table1
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

精彩评论

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