Is there a way to avoid adding a second LEFT JOIN for the table “social_mcouple” to query where social_members.m_id = social_mcouple.c_id below?
$res = @mysql_query("SELECT *, DATE_FORMAT(m_lld,'%m/%d/%y') AS m_lld_formatted FROM social_members
LEFT JOIN social_member_types ON t_id=m_type WHERE m_user='".$en['user']."'");
If there will always be a
social_mcouplethat corresponds tosocial_members, or you’re only interested in rows where there is a correspondence then you may use an INNER JOIN. If you need all social_members regardless of whether there is a correspondingsocial_mcouplethen you will need a LEFT JOIN. TheLEFT JOINwill give you all rows withsocial_mcouple.*set toNULLwhere there is not a match.The performance hit will really depend on the size of your datasets.
EDIT: adding a sample UNION query.