Select those record only from table 1 where city exist against state id in table 2 in PHP

Try like this

SELECT t1.* FROM
table1 t1
JOIN table2 t2 ON(t2.state_id = t1.state AND t2.city!='')

Leave a Comment