Riddhi Valecha

Riddhi Valecha

  • 428
  • 3.2k
  • 397k

SQL Query - Please guide

Oct 11 2017 10:48 AM

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


Answers (3)