例如是这样的,fieldtype:1代表座机 2代表手机
name field fieldtype
李 01058210000 1
王 13512555685 2
李 01052810001 1想出来这样的效果,'.'请忽略
姓名 ........ 座机 ....................................................... 手机
李......01058210000,01052810001
王 .....................................................................13512555685
如果李有手机还是会显示在李的手机列我现在能出来普通行转列的效果
姓名 座机 手机
李 01058210000
王 13512555685请问可以实现吗?以下是我的代码select a.seqno,a.compid,a.name,
max(case b.fieldtype when 1 then field else '' end) 座机,
max(case b.fieldtype when 2 then field else '' end) 手机
from table1 a
group by a.name,a.seqno,a.compid
name field fieldtype
李 01058210000 1
王 13512555685 2
李 01052810001 1想出来这样的效果,'.'请忽略
姓名 ........ 座机 ....................................................... 手机
李......01058210000,01052810001
王 .....................................................................13512555685
如果李有手机还是会显示在李的手机列我现在能出来普通行转列的效果
姓名 座机 手机
李 01058210000
王 13512555685请问可以实现吗?以下是我的代码select a.seqno,a.compid,a.name,
max(case b.fieldtype when 1 then field else '' end) 座机,
max(case b.fieldtype when 2 then field else '' end) 手机
from table1 a
group by a.name,a.seqno,a.compid
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货