2024-10-23 02:41:14
是的我想存成一个字段里!
小名,2014,NULL,aa@..,NULL,123-456-789
而且如你所说
现在真是这样
1000 小名 null null null null null
1000 null 2014 null null null null
刚也在尝试groupby 完全如你预期无法结合
你把
case publications field id when ‘1’ then publications description else 'null'end as column1,
改为
case publications field id when ‘1’ then publications description else null end as column1,
其他几个都改,这样,应该就是
1000 小名 空 空 空 空 空
1000 空 2014 空 空 空 空
。。。。。
然后你用在外面套一层group_concat试试看看出来的结果是什么,我说的是每个字段的结果,
group_concat(case publications field id when ‘1’ then publications description else null end) as column1
你看看字段1-6出的结果是什么。
如果是1000 小名 2014 空 。。。。。那就好了
但如果是1000 小名,,, ,2014,,,, ,,,,,, 。。。。。那就麻烦了。
这时别忘了groupby啊
谢谢你阿 真是对了!
改成null 另加group_concat就对啦!
不过现在就只好乖乖写70行了..
那没办法啊,对了别忘了还要用到ifnull,不然null不显示null这个字符的。呵呵
谢谢你这么仔细教学阿~~~:D 料事如神