2

I have this part of query:

IF(orders = NULL OR orders = '', "value1', 'value2')

which works with empty cells but not with null ones, any help? When it's NULL it doesn't make anything but when it's '' it runs the query

Xriuk
  • 382
  • 2
  • 7
  • 26
  • possible duplicate of [MySQL: selecting rows where a column is null](http://stackoverflow.com/questions/3536670/mysql-selecting-rows-where-a-column-is-null) – GSerg Oct 13 '13 at 10:12

2 Answers2

6

It's spelled orders is NULL (not orders = NULL).

thebjorn
  • 26,297
  • 11
  • 96
  • 138
0

You have to use

IF(orders IS NULL OR orders = '', 'value1', 'value2')

instead

VahiD
  • 1,014
  • 1
  • 14
  • 30