Hi,

I noticed the following strange problem when the expression to WHERE contains clauses that refer to the same column. Here are three queries and their output:


select count(*) from table1
where ((timestamp >13448180261410868) and (timestamp <= 13448182164507680));

output: 100


select count(*) from table1
where (timestamp<=13448180261410868);

output: 46

select count(*) from table1;

output: 100



This cannot be (unless I am missing something). The first query says that between times A and B there are 100 entries. The second query says that before time A there are 46 entries. The last query says that in total there are 100 entries. My logic says that if the first and second queries return the true answer, the total number of entries should be 100 + 46 = 146.

I counted things manually and realized that query 1 is the culprit. It is ignoring the first part of the statement and only evaluating the second part (timestamp <= 13448182164507680)

Anyone has had similar problems?

Thanks
Eno

Reply via email to