MySQL select query return unrelated output -
select updatedate, id,cssn,clname,cfname,cdob,cdod,ccity,cstate,chospital,ccurstatus,cmmrcashworker,ctelephone med_patient ccurstatus!='completed' , cmmrcashworker = '2' , chospital = '1234' or chospital1 = '1234' or chospital2 ='1234' , updatedate between '1/30/2010' , '1/28/2010' order id desc'   output:
updatedate   chospital   chospital1     chospital2  01/15/2010   1234  01/15/2010   1234   but acutally knowledge query must return empty row.
where mistake in query?
try adding parentheses chospital condition, otherwise or not expect:
ccurstatus!='completed' , cmmrcashworker = '2' , (chospital = '1234' or chospital1 = '1234' or chospital2 ='1234') , updatedate between '1/30/2010' , '1/28/2010' order id desc'   also:
... updatedate between '1/30/2010' , '1/28/2010' ...   ^ doing string compare rather date comparison, try changing to:
... updatedate between '2010-01-30' , '2010-01-28' ...      
Comments
Post a Comment