mysql面试题:字段中@之前字符相同且大于等于2条的所有记录

公司发了一张面试题给我,题目如下:

 在test数据库中有个flow_user表,找出email字段中@之前字符相同且大于等于2条的所有记录

答案:

select substring_index(`email`,'@',1) as email,count(*) as count from flow_user group by email having count>=2;

原文地址:https://www.cnblogs.com/qichao123/p/8654119.html