dresende / node-orm2

Object Relational Mapping
http://github.com/dresende/node-orm2
MIT License
3.07k stars 379 forks source link

IF condition #844

Open linfiesto opened 4 years ago

linfiesto commented 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!