我不得不在工作时使用石刀和熊皮,不幸的是LINQ对我来说太好了。这里有什么问题:
SELECT cat_id, cat_parent, CASE WHEN LEN(cat_name) > 36 THEN SUBSTRING(cat_name,0,36) + '...' ELSE cat_name FROM Categories WHERE cat_parent != 0 AND cat_dir = 'Manufacturing'
我收到此错误:
Msg 156, Level 15, State 1, Line 1
Incorrect syntax near the keyword 'FROM'.
答案 0 :(得分:3)
CASE
在END
FROM
答案 1 :(得分:1)
SELECT cat_id, cat_parent,
CASE WHEN LEN(cat_name) > 36 THEN SUBSTRING(cat_name,0,36) + '...' ELSE cat_name END FROM Categories WHERE cat_parent != 0 AND cat_dir = 'Manufacturing'
我在FROM
之前的cat_name之后添加了END答案 2 :(得分:1)
SELECT cat_id, cat_parent, CASE WHEN LEN(cat_name) > 36 THEN SUBSTRING(cat_name,0,36) + '...' ELSE cat_name END AS cat_name FROM Categories WHERE cat_parent != 0 AND cat_dir = 'Manufacturing'
缺少CASE的END