我用案例
写了一个商店程序SELECT TOP(10000) ORDER,ORDERID,CLIENTNUM,
CASE WHEN ExpArrvDate IS NOT NULL AND ActArrvDate IS NULL THEN 'In Transit'
ELSE
CASE WHEN ActArrvDate IS NULL THEN 'NOT COME'
ELSE
CASE WHEN DRV1NUM IS NOT NULL THEN 'WILL Come'
ELSE
CASE WHEN PICKEDUP IS NOT NULL THEN 'Picked By JOHN '
ELSE
CASE WHEN DROPTIME IS NOT NULL THEN 'Dropped Off'
AS OrderDeatils
FROM CTRTABle
我在这个陈述中做错了你能不能帮助我
答案 0 :(得分:1)
您需要END
每个CASE
SELECT TOP(10000) ORDER,ORDERID,CLIENTNUM,
CASE WHEN ExpArrvDate IS NOT NULL AND ActArrvDate IS NULL THEN 'In Transit'
ELSE
CASE WHEN ActArrvDate IS NULL THEN 'NOT COME'
ELSE
CASE WHEN DRV1NUM IS NOT NULL THEN 'WILL Come'
ELSE
CASE WHEN PICKEDUP IS NOT NULL THEN 'Picked By JOHN '
ELSE
CASE WHEN DROPTIME IS NOT NULL THEN 'Dropped Off'
END END END END END -- Added line. Added END for each CASE
AS OrderDeatils
FROM CTRTABle