Jump to content

[SOLVED] Query ?


ainoy31

Recommended Posts

Trying to query a table and one of the column can be values of either NULL, 0, or 1.

 

Here is my query

select complaint_flag, sessionid from table.orders where insert_date >= '2009-05-26' and order_status='done' and complaint_flag != '1' and complaint_flag is null

 

That should return about 1636 rows but it returns zero.  I am missing something here?

 

Much appreciation.  AM

Link to comment
https://forums.phpfreaks.com/topic/162653-solved-query/
Share on other sites

Here is my solution:

 

select complaint_flag, sessionid from govirs.orders where insert_date >= '2009-05-26' and order_status='done' and (complaint_flag != '1' or complaint_flag is null)

 

I needed a () around my OR statement.  I needed to account for the complaint_flag value to be null or zero.

 

Later. AM

Link to comment
https://forums.phpfreaks.com/topic/162653-solved-query/#findComment-858446
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.