Hi guys, RoR/SQL newbie here.
My datetime column 'deleted_at
' are all uninitialized. Running this query returns an error:
SELECT * FROM variants v
ON v.id = ovv0.variant_id INNER JOIN option_values_variants ovv1
ON v.id = ovv1.variant_id INNER JOIN option_values_variants ovv2
ON v.id = ovv2.variant_id INNER JOIN option_values_variants ovv3
ON v.id = ovv3.variant_id INNER JOIN option_values_variants ovv4
ON v.id = ovv4.variant_id
WHERE v.deleted_at = NULL
AND v.product_id = 1060500595
However, if I set my datetime values to 0, and set my query to v.deleted_at = 0
, the correct variant is returned to me.
How do I check for uninitialized/NULL datetimes?