Jump to content

[SOLVED] catching null values


haku

Recommended Posts

With this query:

 

SELECT n.title, n.nid, UNIX_TIMESTAMP(td.deadline) as deadline, td.item_status, td.priority 
FROM {node} as n 
JOIN {to_do} as td 
ON n.vid = td.vid 
JOIN {to_do_assigned_users} as tdau 
ON tdau.vid = n.vid 
WHERE (td.deadline < (CURRENT_DATE() + INTERVAL 7 DAY) OR td.priority = 3) 
AND n.type = 'to_do' AND tdau.uid = 1 AND n.status = 1 AND td.item_status != 2 
ORDER BY deadline 
LIMIT 5, 5

 

Can anyone see why the following query returns values in which td.deadline is NULL? It also doesn't seem to be returning values where td.priority is equal to 3.

 

The following snipped also returns values where td.deadline is NULL:

 

WHERE (td.deadline IS NOT NULL AND td.deadline < (CURRENT_DATE() + INTERVAL 7 DAY) or priority = 3)

 

As does this:

 

WHERE (td.deadline BETWEEN '0000-00-0 00:00:00' AND (CURRENT_DATE() + INTERVAL 7 DAY) or priority = 3)

 

None of them are giving me any luck.

Link to comment
https://forums.phpfreaks.com/topic/165322-solved-catching-null-values/
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.