MYSQL inner join , if not match try another table
Always outer join them, then just use a CASE statement to pick out the info from the relevant table: 

SELECT ref_id, case when p.property_id is null then p2.property_id else p.property_id end
FROM invoices i 
left outer join properties p on i.ref_id = p.property_id 
left outer join properties2 p2 on i.ref_id = p2.property_id;