I'm running this query but it's very slow. The OR clause on the last left join is what bogs it down, but I can't figure out another way to structure the query in order to obtain the results I'm looking for:
SELECT *,
DATE_FORMAT(tbl1.pub, '%m/%d/%Y') AS pub_a,
CONCAT(tbl1.code1, tbl1.code2) AS code_a
FROM (tbl1
INNER JOIN tbl2 ON tbl1.pkid=tbl2.fkid
LEFT JOIN tbl3 ON tbl1.pkid=tbl3.fkid)
LEFT JOIN tbl4 ON tbl1.person=tbl4.code OR tbl3.person=tbl4.code
WHERE tbl1.subcat != ''
AND tbl1.pub < '2014-01-15 13:20:23'
AND tbl1.exp > '2014-01-15 13:20:23'
ORDER BY tbl1.pub DESC
LIMIT 0, 50
CREATE TABLEschema andSHOW INDEXES FROM.