SELECT * FROM content LEFT JOIN table_1 ON (content.page_type=0) WHERE page_type = 0 LEFT JOIN table_2 ON (content.page_type=1) WHERE page_type = 1