Andre Matos writes: > SELECT * FROM scan WHERE TimePointID = 3 AND ScanQCResult = 'n' AND > (ScanStatusID < 90 OR ScanStatusID > 98); > > I realized latter analyzing this select that I made a mistake using OR at > this point: (ScanStatusID < 90 OR ScanStatusID > 98), it should be "AND".
The second rendition "(ScanStatusID < 90 AND ScanStatusID > 98)" will return no rows every time. Since ScanStatusID can not be less than 90 and greater than 98 at the same time :) Something that I've found to improve readability of these kinds of tests is to use "BETWEEN(a, b)" And if you need to exclude a range the use of "NOT BETWEEN(a, b)". This way it becomes obvious what you are looking for. Brad Eacker ([EMAIL PROTECTED]) -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]