I am trying to run a statement against a view as follows:
SELECT ApprLevel, AssignTo, VendorName, DeptName, PreparedBy, OnBehalfOf, CreationDate, Indicator FROM v_Tardy_Docs WHERE PreparedBy = 'Bill Harris' OR OnBehalfOf = 'Bill Harris' AND CreationDate <= '09-jul-2003'
When I run this, I get the selection of the individual fine, but the date restriction doesn't work. If I remove the selection of the individual the date restriction works fine.
I think it has something to do with the OR statement, but I can't figure out what. If I place the two parts of the OR statement in parentheses, the statement returns no records.
What am I doing wrong here?
SELECT ApprLevel, AssignTo, VendorName, DeptName, PreparedBy, OnBehalfOf, CreationDate, Indicator FROM v_Tardy_Docs WHERE PreparedBy = 'Bill Harris' OR OnBehalfOf = 'Bill Harris' AND CreationDate <= '09-jul-2003'
When I run this, I get the selection of the individual fine, but the date restriction doesn't work. If I remove the selection of the individual the date restriction works fine.
I think it has something to do with the OR statement, but I can't figure out what. If I place the two parts of the OR statement in parentheses, the statement returns no records.
What am I doing wrong here?