I have two tables which have structure similar to below 2 tables. Name :
ID | FirstName | LastName
__________________________
123 Akshay kumar
123 Salman khan
123 Johnny lever
123 Tom Cruise
City:
ID | City
___________
123 Pune
Now when I Run the below Query:
Select N.*,C.* from Name N,City C where C.ID=N.ID and N.ID=123;
ID | FirstName | LastName | ID | City
_____________________________________________
123 Akshay kumar 123 Pune
123 Salman khan 123 Pune
123 Johnny lever 123 Pune
123 Tom Cruise 123 Pune
Pune is getting repeated 4 times. Whereas I want output as below:
ID | FirstName | LastName | ID | City
_____________________________________________
123 Akshay kumar 123 Pune
123 Salman khan
123 Johnny lever
123 Tom Cruise
There is no relation between Name and City Table data except the ID Coumn. Also It is not compulsory that Name table will have more entries than City Table for same ID. City Table can also have more rows than Name Table for same ID.(So Left Join won't work) Please Help Guys.