Re: date comparison query

2012-03-17 Thread Hal�sz S�ndor
2012/03/16 13:30 -0400, Simon Wilkinson My query for this is as follows: select * from table where table.date1 - table.date2 between 28425600 and 29030400; I would not count on that subtraction s yielding a meaningful number: the types are not Unix timestamps. I would use TIMESTAMPDIFF, with a

date comparison query

2012-03-16 Thread Simon Wilkinson
Hi, I have a table that holds two datetime columns. I am trying to find values from this table that fall into specific time ranges, but am getting some strange results. For example, if I try to find rows where the difference between the two column is between 47 and 48 weeks, I get back a result

Re: date comparison query

2012-03-16 Thread Baron Schwartz
Simon, It's likely that when you specify the times as integer literals they are being converted to something you don't expect. You can use EXPLAIN EXTENDED followed by SHOW WARNINGS to see what's happening; it might be interesting and educational. I would specify the times you want as datetime