View Full Version : LEFT JOIN Issues...

07-23-2007, 11:21 AM
I have the following query, the bottom line was previously
AND tblrepresentatives.rep_ID LIKE '%$rep%'... This however gave me any rep number which had say '5' in it, so i got results from '5', '25', '15' etc... Changing it to what it is currently make's the rep search work but kills all the other search fields... I've also tried taking out the %% and keeping LIKE but still breaks the search... Any ideas anybody?

$sql = "SELECT tblmembers.*, tblemployment.*,
FROM tblmembers
LEFT JOIN tblrepresentatives ON (tblmembers.rep_ID = tblrepresentatives.rep_ID)
LEFT JOIN tblemployment ON (tblmembers.ID = tblemployment.MembersID)
WHERE tblmembers.FirstName LIKE '%$firstName%'
AND LastName LIKE '%$lastName%'
AND Email LIKE '%$email%'
AND Location LIKE '%$venue%'
AND State LIKE '%$state%'
AND Member LIKE '%$status%'
AND tblrepresentatives.rep_ID = '$rep'";