List:General Discussion« Previous MessageNext Message »
From:Claudia M. Castaneda Date:May 24 1999 7:52pm
Subject:Dates querying Mysql
View as plain text  
Hi,
I have the following data:

mysql>  select obs_id, obs_URI, obs_source, beg_date from observation;
+--------+------------------------------------+------------+------------+
| obs_id | obs_URI                            | obs_source | beg_date   |
+--------+------------------------------------+------------+------------+
|      4 | URIRAC://landsat-7/19990419/120850 | landsat-7  | 1999-04-19 |
|      3 | URIRAC://landsat-7/19990519/90850  | landsat-7  | 1999-05-19 |
|      2 | URIRAC://landsat-7/19990519/90850  | GOES-J     | 1999-05-19 |
|      1 | URIRAC://noaa-14/19990124/90850    | noaa-14    | 1999-01-24 |
|      5 | URIRAC://landsat-7/19990419/120850 | landsat-7  | 1999-04-19 |
|      6 | URIRAC://goes-j/19990202/111250    | goes-j     | 1999-02-02 |
+--------+------------------------------------+------------+------------+
6 rows in set (0.01 sec)

I do

mysql> select obs_id, obs_URI, obs_source, beg_date from observation where
beg_date = '19990519';
+--------+-----------------------------------+------------+------------+
| obs_id | obs_URI                           | obs_source | beg_date   |
+--------+-----------------------------------+------------+------------+
|      3 | URIRAC://landsat-7/19990519/90850 | landsat-7  | 1999-05-19 |
|      2 | URIRAC://landsat-7/19990519/90850 | GOES-J     | 1999-05-19 |
+--------+-----------------------------------+------------+------------+
2 rows in set (0.01 sec)

and

mysql> select obs_id, obs_URI, obs_source, beg_date, beg_time from
observation where beg_date between '1999-01-20' and '1999-05-30';
+--------+------------------------------------+------------+------------+----------+
| obs_id | obs_URI                            | obs_source | beg_date   |
beg_time |
+--------+------------------------------------+------------+------------+----------+
|      4 | URIRAC://landsat-7/19990419/120850 | landsat-7  | 1999-04-19 |
12:08:50 |
|      3 | URIRAC://landsat-7/19990519/90850  | landsat-7  | 1999-05-19 |
09:08:50 |
|      2 | URIRAC://landsat-7/19990519/90850  | GOES-J     | 1999-05-19 |
09:08:50 |
|      1 | URIRAC://noaa-14/19990124/90850    | noaa-14    | 1999-01-24 |
09:08:50 |
|      5 | URIRAC://landsat-7/19990419/120850 | landsat-7  | 1999-04-19 |
12:08:50 |
|      6 | URIRAC://goes-j/19990202/111250    | goes-j     | 1999-02-02 |
11:12:50 |
+--------+------------------------------------+------------+------------+----------+
6 rows in set (0.01 sec)

but the following sql command does not seem to work as I expected it to:

mysql> select obs_id, obs_URI, obs_source, beg_date, beg_time from
observation where beg_date between '19990124' and '19990519';
Empty set (0.01 sec)

or

mysql> select obs_id, obs_URI, obs_source, beg_date, beg_time from
observation where beg_date between '19990120' and '19990530';
Empty set (0.01 sec)

Could any one explain this to me, please?




---
Claudia M. Castaneda
KT-Tech, Incorporated
9801 Greenbelt Rd. Suite 314
Lanham MD 20706  USA
301 552 2411 Fax 301 552 2638

Thread
Dates querying MysqlClaudia M. Castaneda24 May
  • Re: Dates querying MysqlGraeme B. Davis25 May
  • Re: Dates querying MysqlChristian Mack25 May
    • Re: Dates querying MysqlClaudia M. Castaneda25 May
      • Re: Dates querying MysqlJim Faucette25 May
        • Re: Dates querying MysqlClaudia M. Castaneda25 May
          • Re: Dates querying MysqlVivek Khera25 May
        • Re: Dates querying MysqlJim Faucette25 May
          • Re: Dates querying MysqlMichael Widenius2 Jun
            • Re: Dates querying MysqlVivek Khera2 Jun
              • Re: Dates querying MysqlMichael Widenius3 Jun
Re: Dates querying MysqlVivek Khera2 Jun