一张数据表中找出a字段相同,b字段不同的数据

student表中数据如下:

需要找出name相同,score不同的数据,sql如下:

SELECT a.name,a.score from student a,student b where a.name = b.name and a.score != b.score GROUP BY a.name, a.score

结果如下:

Guess you like

Origin blog.csdn.net/u011821510/article/details/103997312