0

this is my query for getting order total for particular date. Here I can't get proper result when using AND (tos.status!='5' or tos.status!='6'). what is the problem in this?

SELECT sum(tot.total) as total 
FROM orders_totals tot, orders tos 
WHERE DATE(tos.`timestamp`) BETWEEN '2013-12-09' AND '2013-12-09' and 
      tot.`order` = tos.id and tot.description='Grand-Total' AND 
     (tos.status!='5' or tos.status!='6')
Saharsh Shah
  • 28,687
  • 8
  • 48
  • 83
PNG
  • 287
  • 2
  • 6
  • 18

1 Answers1

0

Try this:

SELECT sum(tot.total) as total 
FROM orders_totals tot
INNER JOIN orders tos ON tot.`order` = tos.id
WHERE DATE(tos.`timestamp`) BETWEEN '2013-12-09' AND '2013-12-09' and 
      tot.description='Grand-Total' AND tos.status NOT IN (5, 6)
Saharsh Shah
  • 28,687
  • 8
  • 48
  • 83