[LINK] APH Search Engine

Adam Todd at@ah.net
Fri, 02 Jun 2000 23:16:38 +1000


At 21:33 2/06/00 +1000, you wrote:
>On Fri, Jun 02, 2000 at 04:57:35PM +1000, Adam Todd wrote:
> >
> > >Does Date >1-6-00 include 1 June.
> >
> > Yes it should.  It does vary a little depending on the SQL server, but 
> when
> > you ask for dates > dd-mm-yy (or whatever format is accepted) it shuld
> > return everything greater than 2000-06-01 00:00:00
>
>Nope. It will return everything greater than that time/date. Anything entered
>with the time/date of 01/06/2000 00:00:00, or with the date of 01/06/2000
>(with no time) will NOT match this.


Yeah yeah Scott.  Whatever you reckon.  Just makes me wonder how much you 
test your theories before you blart them out.

select indate,uid,seconds from local2 where indate > "2000-05-10";
+---------------------+------+---------+
| indate              | uid  | seconds |
+---------------------+------+---------+
| 2000-05-10 14:39:46 | 2014 |    3158 |
| 2000-05-10 15:45:08 | 2014 |    2627 |
| 2000-05-10 19:29:41 | 2024 |    2148 |
| 2000-05-10 23:34:33 | 2014 |     820 |
| 2000-05-11 11:46:15 | 2014 |    4267 |
| 2000-05-11 14:24:18 | 2014 |     651 |
| 2000-05-11 15:36:44 | 2026 |    1132 |
| 2000-05-11 20:03:14 | 2021 |     179 |
| 2000-05-11 20:07:05 | 2021 |     112 |
| 2000-05-12 09:23:49 | 2014 |    1439 |
| 2000-05-12 09:58:40 | 2014 |   23146 |
| 2000-05-13 13:29:30 | 2010 |    4657 |
| 2000-05-13 18:46:08 | 2014 |    3916 |
| 2000-05-13 20:10:11 | 2016 |     514 |
| 2000-05-14 11:58:00 | 2014 |    1294 |
+---------------------+------+---------+


>The correct term would be date >= 1/6/00

Yeah whatever you recon Scott.

Yes >= date will work, and display everything greater than 2000-06-01 from 
Midnight if it's based on time stamp. It whether you use > date or >= date 
the same results as above are returned.

As to between dates, if you just use the same date twice:

select indate,uid,seconds from local2 where indate between "2000-01-01" and 
"2000-01-01";
Empty set (0.02 sec)

That's because 2000-01-01 00:00:00 is the same as 2000-01-01 00:00:00

So you need to set the next highest qualifier as shown below.

select indate,uid,seconds from local2 where indate between "2000-01-01" and 
"2000-01-02";
+---------------------+------+---------+
| indate              | uid  | seconds |
+---------------------+------+---------+
| 2000-01-01 12:27:46 | 2011 |    2598 |
| 2000-01-01 13:49:42 | 2011 |      91 |
| 2000-01-01 13:52:48 | 2011 |     350 |
| 2000-01-01 13:59:44 | 2011 |     297 |
| 2000-01-01 14:06:06 | 2011 |      64 |
| 2000-01-01 14:10:16 | 2011 |      50 |
| 2000-01-01 14:17:17 | 2011 |     154 |
| 2000-01-01 14:22:24 | 2011 |      38 |
| 2000-01-01 14:25:38 | 2011 |     118 |
| 2000-01-01 14:57:11 | 2011 |      71 |
| 2000-01-01 15:06:39 | 2011 |     128 |
| 2000-01-01 15:14:21 | 2011 |     285 |
| 2000-01-01 15:28:15 | 2011 |      52 |
| 2000-01-01 15:31:17 | 2011 |      78 |
| 2000-01-01 15:49:35 | 2011 |     424 |
| 2000-01-01 15:57:30 | 2011 |     119 |
| 2000-01-01 16:52:33 | 2011 |     408 |
| 2000-01-01 17:19:24 | 2011 |      43 |
| 2000-01-01 17:26:27 | 2010 |     576 |
+---------------------+------+---------+



Bernard, if you want any more examples, let me know.  But again I did say 
it varies on some SQL servers and could very well vary depending on the 
sanity checking applied.