mysql 查询问题 谢谢大家 id name1 a2 b3 b4 c我想要查询不重复的记录怎么查询?也就是 查出来的结果是id (1,4) 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 本帖最后由 ACMAIN_CHM 于 2012-01-09 13:04:48 编辑 select * from table1 a where not exists (select 1 from table1 where name = a.name) SELECT MAX(id) FROM table1 GROUP BY name HAVING COUNT(*)=1 select id from t group by name having count(*) = 1; select * from table a where not exists (select 1 from table1 where a.name=name) select id,name,count(name) a from tableNamegroup by namehaving a=1这样的主要问题是你的数据多吗?name有没有索引,不然可能效率会有影响。 liuxinran819此好汉,方法较好,绿色且速度快。洒家顶之。 select * from t group by name having count(*) = 1; oracle 中相关数据 转换成mysql语句 我这样写不知道有没有隐患啊 [C API 调用存储过程] myeclipse的dbbrower下以及mysql5.0的可视化工具打开表报内存不能读? 请教一条SQL语句,关于新增列 高手留步:MySQL和 MaxDB by mysql 大家新年好,新年第一问:mysql在linux下启动问题请教! 问题对你来说不大 更新表本身,当更新的字段作为where条件时出错,怎么解决? 为什么在linux下安装mysql报错啊 雪地跪等大神啊 用mysql出现的问题?? mysql 存储过程该如何处理存储过程返回的多结果集 救命!!Mysql把数据转换为大写
where not exists (select 1 from table1 where a.name=name)
from tableName
group by name
having a=1
这样的主要问题是你的数据多吗?name有没有索引,不然可能效率会有影响。
此好汉,方法较好,绿色且速度快。洒家顶之。