mysql单表怎么合并多列多行数据 数据表A,字段如下a1 a2 a3张三 李四 王五 张三 王五 李四 张三 赵六 王五 赵六 李四 王五 需要在三个字段中,合并查询出结果是:张三李四王五赵六 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 select distinct a1 from tbunion select distinct a2 from tbunion select distinct a3 from tb 把楼上的给简化一下:select a1 from tbunion select a2 from tbunion select a3 from tb select a1 from tbunion select a2 from tbunion select a3 from tb select distinct a from (select a1 as a from tbunion select a2 as a from tbunion select a3 as a from tb) t distinct效率是比较差的。 union已经是去除掉重复的数据了 将sql server的函数方法转换成MySQL请各位高手指点。 被困2天:查询工具里运行简单的函数报错 query has no destination for result data 统计问题 同一个表内 UPDATE SELECT COUNT 排序的问题 mysql5.0.22不支持存储过程调用存储过程吗? 程序连接成功,用mysqlcc连接管理却出错,望解,谢谢 mysql 的怪问题 大家有没有自己动手做过分库分表的实例? 查询数据库报错 MySQL8有没有32位的免安装zip版本,官网上好像只有64位的压缩包没有32位的 mysql分表的问题 请教一个mongodb的数据库问题
union
select distinct a2 from tb
union
select distinct a3 from tb
把楼上的给简化一下:select a1 from tb
union
select a2 from tb
union
select a3 from tb
union
select a2 from tb
union
select a3 from tb
from
(
select a1 as a from tb
union
select a2 as a from tb
union
select a3 as a from tb
) t