码迷,mamicode.com
首页 > 数据库 > 详细

sql 根据字段查询不同表

时间:2016-12-07 22:52:54      阅读:259      评论:0      收藏:0      [点我收藏+]

标签:vcs   nes   ati   bsp   and   查询   span   font   nbsp   

SELECT snFundType,snBusinessType,
CASE WHEN a.snFundType=10 AND a.snBusinessType =10 THEN 
(select vcPaySerialNo from aa where vcSerialNo=a.vcRelationSerialNo)
WHEN a.snFundType=11 AND a.snBusinessType =11 THEN
(select vcPaySerialNo from bb where vcSerialNo=a.vcRelationSerialNo)
END AS 姓名

FROM cc a

 

sql 根据字段查询不同表

标签:vcs   nes   ati   bsp   and   查询   span   font   nbsp   

原文地址:http://www.cnblogs.com/ghelement/p/6142794.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!