我有 3 个字段
PId Name Address
1 aaaa 1234
2 bbbb 4567
3 cccc 1234
4 dddd 4567
我的查询是
SELECT DISTINCT s.Name,ss.Name From Students s INNER JOIN Students ss ON s.PId!=ss.PId WHERE s.Address = ss.Address GROUP BY s.Name,ss.Name
我想得到地址相同的名字,但我是这样的
aaaa cccc
bbbb dddd
cccc aaaa
dddd bbbb
而且我要
aaaa cccc
bbbb dddd
只要