Skip to content

How to return rows if date is null #1035

Answered by simolus3
HasanAlqaisi asked this question in Q&A
Discussion options

You must be logged in to vote

.equals generates an = in SQL. So if you did doneAt.equals(null), moor would generate done_at = NULL. In SQL, comparisons with NULL don't evaluate to a value, so you can't use that. What you should use is done_AT IS NULL, for which you can use the isNull function in moor:

return (select(taskTable)..where((tbl) => tbl.userId.equals(userId) &isNull(tbl.doneAt))
  .join([...])
  // ...

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by HasanAlqaisi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants