Open linfiesto opened 4 years ago
Hi, sorry but I'm somehow confused on how to exactly do query condition for IF and IS NULL
I have this particular SQL query but not sure how to convert it to ORM.
WHERE has_sent = 0 AND messenger_messages.create_date >= IF(users.last_login IS NULL, ( Curdate() - interval 1 month ), users.last_login + interval 5 minute)
Hope you can help. Thanks!
Hi, sorry but I'm somehow confused on how to exactly do query condition for IF and IS NULL
I have this particular SQL query but not sure how to convert it to ORM.
WHERE has_sent = 0 AND messenger_messages.create_date >= IF(users.last_login IS NULL, ( Curdate() - interval 1 month ), users.last_login + interval 5 minute)
Hope you can help. Thanks!