0

I am using symfony1.4 and doctrine. I need to check a condition where the value is NULL. I nedd to write a query where status = 1 and start=NULL and end= NULL and estimated_time != NULL .I have tried with this but i am not able to get the result.

            $tickets = Doctrine_Core::getTable('table')
              ->createQuery('a')
              ->where('status=?','1')
              ->andWhere('start=?', '')
                              ->andWhere('end=?', '')
              ->andWhere('estimated_time!=?','')
              ->orderBy('id DESC');

any help will be greatly appreciated.Thank You..

Juice
  • 3,023
  • 6
  • 39
  • 66

1 Answers1

1

Try using IS NOT NULL:

$tickets = Doctrine_Core::getTable('table')
    ->createQuery('a')
    ->where('status=?','1')
    ->andWhere('start IS NOT NULL')
    ->andWhere('end IS NOT NULL')
    ->andWhere('estimated_time IS NOT NULL')
    ->orderBy('id DESC');
Mike Purcell
  • 19,847
  • 10
  • 52
  • 89