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 |
Hmm.
Bit Odd. However, I suspect the problem is that your 'where' isn't explicit
enough:
Where ( month(date) = month(now()) ) or ( month(date) = month(now())-1 )
Bear in mind that if month(now()) = 1 you will be looking for records in
month 0!
A better way to do this might be:
WHERE
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| |