I'm new to MySQL and I want to return data from two tables only when the Mobile numbers in both the table are same. I don't want any null
values. How can I achieve this?
Example:
Table A
UserID CandidateName CurrentMobile CurrentDistrict Email Centre
1 Max 98234 Chennai aaa@a.com A
2 Raju 97364 Salem bbb@b.com B
3 Ramesh 99873 Trichy ccc@c.com C
Table B
Name MobileNumber District
Maximus 98234 Salem
Ramesh 99873 Trichy
Venkat 98376 Chennai
I want the following result:
UserID CandidateName Name CurrentDistrict District Email Centre MobileNumber
1 Max Maximus Chennai Salem aaa@a.com A 98234
3 Ramesh Ramesh Trichy Trichy ccc@c.com C 99873
I tried to use UNION
, but it gives null
values in some columns and also returns all the data from both the tables.