假设我有学生桌
卷名 1个Nitin 2罗希特 3尼丁
那我想找到非重复的名字。所以它应该只给我罗希特。得到它了。谢谢你等待答案
答案 0 :(得分:0)
1)计算子查询t1中出现的次数2)内部连接到子查询
drop table if exists t;
create table t (id int,name varchar(10));
insert into t values (1,'nitin'),(2,'rohan'),(3,'nitin');
select t.*
from t
join
(
select t.name
from t
group by t.name having count(*) = 1
) t1 on t1.name = t.name;
+------+-------+
| id | name |
+------+-------+
| 2 | rohan |
+------+-------+
1 row in set (0.02 sec)