user1411837 user1411837 - 1 year ago 48
SQL Question

Check id joining 3 tables

I have a MySQL JOIN query where 2 tables are joined to get the output

select distinct (a.error_type),a.links_id, a.crawl_cycle , b.* from $table a inner join crawler_error_type b on a.error_type = b.error_type where a.projects_id = '$pid' and b.error_priority_page_level='High'

Now I want to check if the value of the field
is present in the third table. If it is present then it shouldn't give me the resulted row.

sel sel
Answer Source

Add the below:

LEFT OUTER JOIN third_table c ON c.error_type = a.error_type 


WHERE c.error_type is null

LEFT OUTER JOIN will display all the records from a table joining on third_table. Since you do not want the record with matching error type from third_table, use WHERE c.error_type is null