List:General Discussion« Previous MessageNext Message »
From:Paul DuBois Date:August 20 1999 7:01pm
Subject:Re: What am I doing wrong in this select?
View as plain text  
At 8:12 PM +0300 8/20/99, Jani Tolonen wrote:
>Sean L. Gilley writes:
> >
> > I'm very confused.  If I do the following select:
> >
> >      select startdate,enddate,machine from sched_data where 
>(startdate >= '1999-08-01 00:00:00'  and enddate < '1999-09-01') 
>and project_id='1-GSMPh4-(K_B)'
> >
> > I get the following output:
> >
> >      +---------------------+---------------------+-----------+
> >      | startdate           | enddate             | machine   |
> >      +---------------------+---------------------+-----------+
> >      | 1999-08-31 00:00:00 | 1999-08-31 01:00:00 | SCP2      |
> >      | 1999-08-02 00:00:00 | 1999-08-02 16:00:00 | SCP18     |
> >      | 1999-08-03 00:00:00 | 1999-08-03 16:00:00 | SCP18     |
> >      | 1999-08-04 00:00:00 | 1999-08-04 16:00:00 | SCP18     |
> >      | 1999-08-05 00:00:00 | 1999-08-05 16:00:00 | SCP18     |
> >      | 1999-08-06 00:00:00 | 1999-08-06 16:00:00 | SCP18     |
> >      | 1999-08-01 00:00:00 | 1999-08-01 16:00:00 | GRAFITE_F |
> >      | 1999-08-19 00:00:00 | 1999-08-19 16:00:00 | SCP18     |
> >      | 1999-08-09 20:00:00 | 1999-08-09 23:00:00 | SCP10     |
> >      +---------------------+---------------------+-----------+
> >      9 rows in set (0.04 sec)
> >
> > But if I do this select:
> >
> >      select startdate,enddate,machine from sched_data where 
>(startdate >= '1999-08-01 00:00:00'  and enddate < '1999-09-01') 
>and project_id='1-GSMPh4-(K_B)' and machine='SCP18'
> >
> > I get:
> >
> >      Empty set (0.00 sec)
> >
> > What am I doing wrong?
> >
> > Sean.
>
>Hello Sean,
>
>Please verify first that machine name doesn't have any
>trailing white spaces in the name. If not, you might have found
>a bug, please do the following:


Not necessarily a bug.  It might just be a binary column:

% mysql
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 3 to server version: 3.23.1-alpha-log

Type 'help' for help.

mysql> select "abc" = "abc ";
+----------------+
| "abc" = "abc " |
+----------------+
|              1 |
+----------------+
1 row in set (0.02 sec)

mysql> select "abc" = binary "abc ";
+-----------------------+
| "abc" = binary "abc " |
+-----------------------+
|                     0 |
+-----------------------+
1 row in set (0.03 sec)

-- 
Paul DuBois, paul@stripped
Thread
What am I doing wrong in this select?Sean L. Gilley20 Aug
  • What am I doing wrong in this select?Jani Tolonen20 Aug
    • Re: What am I doing wrong in this select?Paul DuBois20 Aug
Re: What am I doing wrong in this select?Shaoping Xie20 Aug