I have a query to be run in one IAM tool where we are comparing last passwordchangedate and now.
i just needs to know whether below query will throw error if we pass null value inside DATEDIFF()?
SELECT DISTINCT
u.username AS UName,
u.statuskey AS SK,
CASE
WHEN DATEDIFF(NOW(), u.createdate) >= 30 AND DATEDIFF(Now(),a.LASTPASSWORDCHANGE) <= 30 AND u.customproperty18 !=’Y’ AND u.customproperty63 IS NULL THEN ‘Inactive’
ELSE u.customproperty17
END AS CP17
FROM
users u
WHERE
((DATEDIFF(Now(),u.createdate) > 30 AND DATEDIFF(Now(),a.LASTPASSWORDCHANGE) <= 30
i just needs to know what will happen if we pass null in DATEDIFF and what is solution for this.
what i needs to modify in my above query