php - join two tables and select records only if NOT in table 2 -
I would like to be included in two tables and would like to print the record from table 1 where rec_number is not in Table 2.
Table 1 name rec_number John Smith 123 Bob jonson 345 etc. Table 2 Bob jonson 345 etc.
What is the query in php so that the query returns only I'm John Smith, Bob Johnson. This is: Select from the RECNAMBER 1 on the left side of the table 1 on the <1>
$ query = "table1.rec_number = table2.rec_number" * "; $ result = mysql_query ($ query);
< / Pre>Thank you.
You can use this query
< Pre> select t1. From the table 1 t1 join the left table 2 t2 at t2.rec_number = t1.rec_number where t2.rec_number is the null
Comments
Post a Comment