表内容如:
id name
1 AAA
2 AAA
3 BBB
4 CCC
5 BBB希望取出
id name
1 AAA
2 AAA
3 BBB
5 BBB就是希望不要取出仅仅现过一次的CCC这一行。
谢谢!
id name
1 AAA
2 AAA
3 BBB
4 CCC
5 BBB希望取出
id name
1 AAA
2 AAA
3 BBB
5 BBB就是希望不要取出仅仅现过一次的CCC这一行。
谢谢!
解决方案 »
- 急,mysql大数据量性能优化
- 关于replication的问题
- 错误调查:table is full,cannot find a free slot for an undo log
- PostgreSQL在执行update、insert、delete时是操作写磁盘的操作?
- sqlserver->mysql语句翻译
- 更新数据表
- 关于开放MySQL的远程权限??
- 没分,就随便讨论一下!
- 初看数据库,对锁很不了解,求教。
- 如何在mysql数据库中写一个事物?(有多条sql语句,如果有一条失败,那么已经操作的sql语句全部取消操作)
- 请教一个mysql的分组查询问题?
- perl(Class::MethodMaker) is needed by 怎么处理
-> (
-> id int not null auto_increment primary key,
-> name char(3)
-> );
Query OK, 0 rows affected (0.08 sec)mysql> insert into t1 (name) values
-> ('AAA'),('AAA'),('BBB'),('CCC'),('BBB');
Query OK, 5 rows affected (0.06 sec)
Records: 5 Duplicates: 0 Warnings: 0mysql> select * from t1;
+----+------+
| id | name |
+----+------+
| 1 | AAA |
| 2 | AAA |
| 3 | BBB |
| 4 | CCC |
| 5 | BBB |
+----+------+
5 rows in set (0.02 sec)mysql> select * from t1 group by name having count(name) >1;
+----+------+
| id | name |
+----+------+
| 1 | AAA |
| 3 | BBB |
+----+------+
2 rows in set (0.00 sec)