[quote:31qz9bo9]
DB::Execute('SELECT * FROM table WHERE f_input_date = %T or %T is null', array($date))
[/quote:31qz9bo9]
I'm not sure, but you want to get all records if you pass $date = null? Problem is that %T won't return SQL NULL. I suggest to cast to boolean
DB::Execute('SELECT * FROM table WHERE f_input_date = %T or %b is false', array($date, boolval($date)))
Or build your sql like this:
$sql = 'SELECT * FROM table';
$args = array();
if ($date) {
$sql .= ' WHERE f_input_date = %T';
$args[] = $date;
}
DB::Execute($sql, $args);
Regards,
Adam