Miroslav Savel :
If I have following SELECT statements:
SELECT COUNT(*)
FROM table1
returns 500 rows in table (There are no rows with age = NULL)
SELECT first_name, last_name, occupation
FROM table1
WHERE age <= 10
returns 200 rows in table
SELECT occupation, last_name, first_name
FROM table1
WHERE age > 10
returns 320 rows in table
How can be this possible? The numbers were chosen arbitrary but what can be the reason? Thank you for your suggestions.
jarlh :
table1 is actually a view, and the age value is calculated at select time. If you wait for months until you execute query 2, perhaps 20 persons has turned 11.
Lesson to be learned: never store age, store date of birth!
Guess you like
Origin http://43.154.161.224:23101/article/api/json?id=372424&siteId=1