I have two tables in a database
First of all I have used the
INNER JOIN to obtain values from table1 and table2.
SELECT table1.id, table1.name, table2.location, table2.address FROM table1 INNER JOIN table2 ON table1.id=table2.id;
This query works just fine but the thing is that the address column in table2
table2.address contains empty/no values. Which I don’t want to fetch. How to customize this query?
I also want to filter a specific location
For example, in simple words I want that when the results are fetched the location has to be “London” and addresses that are
Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.
SELECT table1.id, table1.name, table2.location, table2.address FROM table1 INNER JOIN table2 ON table1.id=table2.id WHERE table2.address IS NOT NULL AND table2.location = 'London' ;