node-orm2 icon indicating copy to clipboard operation
node-orm2 copied to clipboard

IF condition

Open linfiesto opened this issue 6 years ago • 0 comments

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!

linfiesto avatar Jul 03 '19 10:07 linfiesto