我在表“ customer
”中有数据,例如
ID NAME CITY
11 John A
12 Peter B
13 Robin A
14 Steve C
15 Methew D
16 Matt C
17 Nancy C
18 Oliver D
我希望查询仅显示同一城市中每2个客户的数据。
输出应为,
ID NAME CITY
11 John A
13 Robin A
15 Methew D
18 Oliver D
SELECT a.Id
,a.Name
,a.City
FROM Customer AS a
INNER JOIN Customer AS b ON a.City = b.City