• 全部
  • 基础类
  • 应用实例
  • 新技术前沿

SQL 问题66

gagaxiaoyuer 2008-03-25 09:33:22
SELECT 'p4.fpartner_code'=
CASE WHEN 02 THEN '石头'
WHEN 05 THEN '火头'
WHEN 08 THEN '东头'
END
p3.fpartner_code,p2.fpartner_code,FCONCENTRATOR_OLD,FADDR1,FMTR_ID,FTYPE,FGENERAL_NO
FROM POWER_DEVICE PD
JOIN POWER_METER PM ON PD.FCONCENTRATOR_NO=PM.FCONCENTRATOR_NO
JOIN PARTNER_ADDRESS PDD ON PDD.FPARTNER_ID=PM.FPARTNER_ID
JOIN PARTNER P1 ON P1.FPARTNER_ID=PM.FPARTNER_ID
join partner p2 on p1.fupline=p2.fpartner_code
join partner p3 on p2.fupline=p3.fpartner_code
join partner p4 on p3.fupline=p4.fpartner_code
WHERE FDEVICE_CODE LIKE '%COM%'


我怎么样把 上面 WHEN 02 THEN '石头',WHEN 05 THEN '火头'写正确 我这样写不对
...全文
27 点赞 收藏 4
写回复
4 条回复
切换为时间正序
当前发帖距今超过3年,不再开放新的回复
发表回复
gagaxiaoyuer 2008-03-25
出的全部是问号 P4 这列
回复
heshengfen123 2008-03-25
SELECT 'p4.fpartner_code'= 
CASE p4.fpartner_code
WHEN 02 THEN '石头'
WHEN 05 THEN '火头'
WHEN 08 THEN '东头'
else p4.fpartner_code
END ,
p3.fpartner_code,p2.fpartner_code,FCONCENTRATOR_OLD,FADDR1,FMTR_ID,FTYPE,FGENERAL_NO
FROM POWER_DEVICE PD
JOIN POWER_METER PM ON PD.FCONCENTRATOR_NO=PM.FCONCENTRATOR_NO
JOIN PARTNER_ADDRESS PDD ON PDD.FPARTNER_ID=PM.FPARTNER_ID
JOIN PARTNER P1 ON P1.FPARTNER_ID=PM.FPARTNER_ID
join partner p2 on p1.fupline=p2.fpartner_code
join partner p3 on p2.fupline=p3.fpartner_code
join partner p4 on p3.fupline=p4.fpartner_code
WHERE FDEVICE_CODE LIKE '%COM%'
回复
dawugui 2008-03-25
SELECT 'p4.fpartner_code'=
CASE 某个字段 WHEN 02 THEN '石头'
WHEN 05 THEN '火头'
WHEN 08 THEN '东头'
END
回复
heshengfen123 2008-03-25
SELECT 'p4.fpartner_code'=
CASE p4.fpartner_code
WHEN 02 THEN '石头'
WHEN 05 THEN '火头'
WHEN 08 THEN '东头'
else p4.fpartner_code
END[color=#FF0000] ,
[/color]p3.fpartner_code,p2.fpartner_code,FCONCENTRATOR_OLD,FADDR1,FMTR_ID,FTYPE,FGENERAL_NO
FROM POWER_DEVICE PD
JOIN POWER_METER PM ON PD.FCONCENTRATOR_NO=PM.FCONCENTRATOR_NO
JOIN PARTNER_ADDRESS PDD ON PDD.FPARTNER_ID=PM.FPARTNER_ID
JOIN PARTNER P1 ON P1.FPARTNER_ID=PM.FPARTNER_ID
join partner p2 on p1.fupline=p2.fpartner_code
join partner p3 on p2.fupline=p3.fpartner_code
join partner p4 on p3.fupline=p4.fpartner_code
WHERE FDEVICE_CODE LIKE '%COM%'
回复
相关推荐
发帖
MS-SQL Server
创建于2007-09-28

3.3w+

社区成员

MS-SQL Server相关内容讨论专区
申请成为版主
帖子事件
创建了帖子
2008-03-25 09:33
社区公告
暂无公告