None should be IS NULL in SQL? #1

Closed
keitheis opened this Issue Mar 31, 2013 · 0 comments

Comments

Projects
None yet
2 participants
@keitheis
table = "wants"
updated_at_field = "wants.updated_at"

select_sql = select(table, {updated_at_field: None})

print(select_sql)
print(db.session.execute(select_sql).rowcount)

Output:
SELECT * FROM wants WHERE wants.updated_at = null
0

select_sql = ("SELECT * FROM " + table
              + " WHERE " + updated_at_field + " IS NULL")
print(select_sql)
print(db.session.execute(select_sql).rowcount)

Output:
SELECT * FROM wants WHERE wants.updated_at IS NULL
37

@moskytw moskytw closed this in ebfc6c4 Mar 31, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment