mysql 语句将字符串转行
mysql 语句将字符串转行示例(SELECT 考籍号,GROUP_CONCAT(kemu) ‘kemu2’ from (SELECT 考籍号,substring_index(substring_index(t.考试科目,’,’, b.help_topic_id + 1), ‘,’, -1) ‘kemu’FROM 省考籍信息77923 tjoin mysql.help_topic b ON b.h
mysql 语句将字符串转行
示例
(
SELECT 考籍号,GROUP_CONCAT(kemu) ‘kemu2’ from (
SELECT 考籍号,substring_index(substring_index(t.考试科目,’,’, b.help_topic_id + 1), ‘,’, -1) ‘kemu’
FROM 省考籍信息77923
t
join mysql.help_topic b ON b.help_topic_id < (LENGTH(t.考试科目) - LENGTH(REPLACE(t.考试科目, ‘,’, ‘’)) + 1)
) t where t.kemu<>’’ GROUP BY 考籍号
)
########################
**
查询两张表 考试科目不一样的人 使用身份证号做关联
**
select * from b1 a
where not exists (select 1 from b2 b where a.kemu=b.kemu and a.身份证号=b.身份证号);
select * from b2 a
where not exists (select 1 from b1 b where a.kemu=b.kemu and a.身份证号=b.身份证号);
更多推荐
所有评论(0)