This is my table:
mysql desc testing;
+---+--+--+-+-+---+
| Field | Type | Null | Key | Default | Extra |
+---+--+--+-+-+---+
| date | date | YES | | NULL| |
+---+--+--+-+-+---+
Here are the values:
Try using
IN(Month(Now()), Month(Now()) -1)
-Original Message-
From: mayuran
To: [EMAIL PROTECTED]
Sent: 5/3/04 10:15 AM
Subject: WHERE clause problem
This is my table:
mysql desc testing;
+---+--+--+-+-+---+
| Field | Type | Null | Key | Default | Extra
(date) BETWEEN month(now() - interval 1 month) AND month(now)
Cheers,
Matt
-Original Message-
From: mayuran [mailto:[EMAIL PROTECTED]
Sent: 03 May 2004 16:15
To: [EMAIL PROTECTED]
Subject: WHERE clause problem
This is my table:
mysql desc testing
From: mayuran [mailto:[EMAIL PROTECTED]
Here is my question:
The following query returns incorrect rows and I dont understand why.
mysql SELECT * FROM testing WHERE MONTH(date) = (MONTH(NOW()) OR
MONTH(NOW())-1);
++
| date |
++
| 2004-01-01 |
mayuran wrote:
This is my table:
mysql desc testing;
+---+--+--+-+-+---+
| Field | Type | Null | Key | Default | Extra |
+---+--+--+-+-+---+
| date | date | YES | | NULL| |
+---+--+--+-+-+---+
At 11:15 -0400 5/3/04, mayuran wrote:
This is my table:
mysql desc testing;
+---+--+--+-+-+---+
| Field | Type | Null | Key | Default | Extra |
+---+--+--+-+-+---+
| date | date | YES | | NULL| |
Is there an solution for the behavior of mysql, described below?
I'm using mysql 3.23.41 on MacOSX...
The problem is, that MySQL isn't able to use indexes for OR in the WHERE
clause yet and therefore the additional OR prevents optimal use of
indexes. MySQL uses only one index for a select, so it
Michael Braun wrote:
I'm using mysql 3.23.41 on MacOSX...
The problem is, that MySQL isn't able to use indexes for OR in the WHERE
clause yet and therefore the additional OR prevents optimal use of
indexes. MySQL uses only one index for a select, so it can't use an index
when there is an