Difference between two queries marked with ^
SELECT COUNT(*)
FROM customers_reports AS cr
JOIN customers_docs on customers_docs.customerId=cr.customerId
WHERE cr.firstDepositDate >= 2015-12-01 AND customers_docs.docs = "None";
This query returns 2 results.
SELECT COUNT(*)
FROM customers_reports AS cr
JOIN customers_docs on customers_docs.customerId=cr.customerId
WHERE cr.firstDepositDate >='2015-12-01' AND customers_docs.docs = "None";
^ ^
While this query returns 30,000 results.
May someone explain why?
解决方案
Without single quotes the date value becomes the arithmetic expression and 2015-12-01 is 2002 which is obviously affect the result