Dear all,
I am again stuck up in making SQL Select Query…
Please guide…
SQL Server Structure
TBLCity
| ID | CityName |
| 1 | Mumbai |
| 2 | Navi Mumbai |
| 3 | Thane |
| 4 | Pune |
| 5 | Latur |
TBLLocations
| ID | CityID (Foreign Key for TBLCity) | Area |
| 1 | 2 | Airoli Sector-15 |
| 2 | 2 | Ghansoli Naka |
| 3 | 2 | Kharghar |
| 4 | 3 | Kalyan |
| 5 | 3 | Ambarnath |
| 6 | 3 | Bhiwandi |
| 7 | 4 | Haveli Taluka |
| 8 | 4 | Bhor |
| 9 | 4 | Baramati |
| 10 | 1 | Dadar |
| 11 | 1 | BKC(Bandra-Kurla Complex) |
Select
(select city.CityName from TBLCity city where city.ID = locations.CityID),
locations.Area
from TBLLocations locations
This gives output as –
| CityID (Foreign Key for TBLCity) | Area |
| Navi Mumbai | Airoli Sector-15 |
| Navi Mumbai | Ghansoli Naka |
| Navi Mumbai | Kharghar |
But now, I need the output as –
Mumbai- Dadar, BKC(Bandra-Kurla Complex)
Thane-Kalyan,Ambernath
How do I get this output ?
Please guide
Ankit SharmaPosted Oct 11, 2017, 2:33 PM
Riddhi ValechaPosted Oct 11, 2017, 12:34 PM
Ankit SharmaPosted Oct 11, 2017, 11:13 AM