Mysql condition not working

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')

Answers


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)

Need Your Help

Question about PHP function return

php mysql function codeigniter return

The following codeigniter function takes a (string) parameter and returns the (integer) ID of the row. It works fine if i pass string values, but if integer 0 is passed, it returns ID of first row in

How to show last added data in table without reload it?

iphone objective-c xcode uitableview tablecell

I have a tableview and at the time of viewDidLoad there are 20 rows. Now I have a button to add 1 more row data in table. At this time I don't want to reload the table and want to show updated tabl...

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.