MYsql Query using not like
Posted on 2012-04-05
I have a query and it doesn't work very well
I have put in a not like statement in the query and my thinking is that the query would catch everything including the null values for the field except it doesn't. If the field is empty it doesn't catch the record.
The query is
SELECT (DATE_FORMAT(Posted, '%Y%m01')) as YM, Count(INum) AS ICount, AVG(Sub) AS Average, Sum(Sub) AS SubTotal, Store, Emp FROM main WHERE (Cdate between 20110331 AND 20120331) AND ANumber like '%cash%' and Status not like 'Credit%' group by Store, Emp, YM