Select 2 records which were grouped, Then put them in 2 columns along side
In a table we have schools' data:
ID | Name | City
------------------
1 A X
2 B Y
2 C Z
I want to have a list of each two schools that are in the same city:
Name1 | Name2
--------------
A B
C D
I chose schools in the same city with this:
SELECT Name FROM Schools
Group by City
Having City = City
Is it correct? How to bring 2 matched schools on a new table along side?
Thanks
No comments:
Post a Comment