Left join query is producing unexpected results

I’m a bit confused why I am getting rows where senMatches = ‘No’ and lastMatch = '2012-09-27’. Any thoughts?

Thanks!

	SELECT
	  u.uID,
	  u.firstName,
	  u.lastName,
	  u.email,
	  u.sendMatches, 
	  date_format(u.lastMatch, '%m-%d-%Y') as lastMatch,
	  s.sID,
	  date_format(s.searchDate, '%m-%d-%Y') as searchDate,
	  s.uID,
	  s.type,
	  s.keyword,
	  s.alerts,
	  date_format(s.lastAlert, '%m-%d-%Y') as lastAlert,
	  s.clicks,
	  date_format(s.lastClick, '%m-%d-%Y') as lastClick,
	  date_format(u.lastLogin, '%m-%d-%Y') as lastLogin
	FROM searches s
	LEFT JOIN users u
	   ON s.uID = u.uID
	WHERE MATCH (keyword) AGAINST ('sport' in boolean mode) or keyword in ('')
	 and u.sendMatches = 'Yes' 
	 and u.bouncing = 'No'		 
	 and date(u.lastMatch) <> '2012-09-27' 
	 and s.type in ('basic', 'advanced')
	GROUP BY
	 u.uID
	ORDER BY
	 s.searchDate

You have a problem with AND and OR clauses.

wrap this in brackets instead:
WHERE (MATCH (keyword) AGAINST (‘sport’ in boolean mode) or keyword in (‘’))

actually this wasn’t right but is important as well:

when writing a LEFT JOIN any conditions on the right hand table belong in the LEFT JOIN clause and not in the WHERE clause. Putting them in the WHERE clause effectively changes your join to an INNER JOIN because it discards all the rows that are null that don’t match the where clause. So move conditions on the Users table into the join with an AND and put those conditions before the WHERE.

Thank you, that did the trick!