假设我有表学生
卷名1 尼廷2 罗希特3 尼廷
然后我想找到不重复的名字。 所以它应该只返回我罗希特。 知道了。 感谢您等待答案
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)