2

In a fetchAll() I'm trying to filter out some options I don't want to fetch. But using NOT IN does give a empty array. While using only IN with the same parameters it's working:

$model->fetchbysql("shortcut NOT IN (2, 3)", null, null);  // Not working
$model->fetchbysql("shortcut IN (2, 3)", null, null);      // Working
Florent
  • 12,310
  • 10
  • 49
  • 58
Nicklas
  • 39
  • 4
  • 1
    May be this answer will help u – kiran Sep 13 '12 at 10:10
  • Your question suggests that the only actual values of the `shortcut` column are `2`, `3` and `NULL`. As most queries involving `NULL` result in `NULL` or `UNKNOWN` depending on the rdbs used, and as neither of these is considered true, those `NULL` rows will be selected by neither query. – MvG Sep 13 '12 at 23:09
  • @Nicklas Not working as in *returns no rows*? Does it return an error? – Mikulas Dite Sep 24 '12 at 21:25

1 Answers1

0

Try to make your queries like this.

SELECT * FROM usermaster WHERE UserId IN (1, 2, 3, 4, 5);

and

SELECT * FROM usermaster WHERE UserId NOT IN (1, 2, 3, 4, 5);

Both SQL queries will work fine.

Bhoopesh Pathak
  • 179
  • 1
  • 11