Eno Thereska <[EMAIL PROTECTED]> wrote: > 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 >
Some of your timestamp values might be stored as strings instead of numbers. A string always compares greater than a number. What does this show you: SELECT DISTINCT typeof(timestamp) FROM table1; If this is the problem, you can fix it quickly by doing: UPDATE table1 SET timestamp=timestamp+0; -- D. Richard Hipp <[EMAIL PROTECTED]>