user1411837 user1411837 - 7 months ago 11
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
error_type
is present in the third table. If it is present then it shouldn't give me the resulted row.

sel sel
Answer

Add the below:

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

and

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