resubmitted
Selon [EMAIL PROTECTED]:

> hi,
> that's the same. If you use between, mysql do the rest for you :
>
> mysql> explain SELECT * FROM passengers WHERE
>     -> reservation_date_time >= '2005-01-01 12:10:00'
>     -> AND reservation_date_time <= '2005-05-01 12:10:00';
>
+----+-------------+------------+-------+---------------+--------+---------+------+------+--------------------------+
> | id | select_type | table      | type  | possible_keys | key    | key_len |
> ref
>  | rows | Extra                    |
>
+----+-------------+------------+-------+---------------+--------+---------+------+------+--------------------------+
> |  1 | SIMPLE      | passengers | range | reserv        | reserv |       9 |
> NULL |    1 | Using where; Using index |
>
+----+-------------+------------+-------+---------------+--------+---------+------+------+--------------------------+
> 1 row in set (0.01 sec)
>
> mysql> explain SELECT * FROM passengers WHERE
>     -> reservation_date_time between '2005-01-01 12:10:00'AND '2005-05-01
> 12:10:00';
>
+----+-------------+------------+-------+---------------+--------+---------+------+------+--------------------------+
> | id | select_type | table      | type  | possible_keys | key    | key_len |
> ref
>  | rows | Extra                    |
>
+----+-------------+------------+-------+---------------+--------+---------+------+------+--------------------------+
> |  1 | SIMPLE      | passengers | range | reserv        | reserv |       9 |
> NULL |    1 | Using where; Using index |
>
+----+-------------+------------+-------+---------------+--------+---------+------+------+--------------------------+
> 1 row in set (0.00 sec)
>
> Mathias
>
>
> Selon Cory Robin <[EMAIL PROTECTED]>:
>
> > I'm trying to return all records between two dates..  The fields are
> > datetime fields...
> >
> > Which is better?  The following or using BETWEEN? (A little lost here)
> >
> > SELECT * FROM passengers WHERE
> > reservation_date_time >= '2005-01-01 12:10:00'
> > AND reservation_date_time <= '2005-05-01 12:10:00';
> >
> >
> >
> > --
> > MySQL General Mailing List
> > For list archives: http://lists.mysql.com/mysql
> > To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]
> >
> >
>
>
>



-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to