RE: WHERE clause problem

2004-05-03 Thread Victor Pendleton
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 |

RE: WHERE clause problem

2004-05-03 Thread Matt Chatterley
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

RE: WHERE clause problem

2004-05-03 Thread Mike Johnson
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 |

Re: WHERE clause problem

2004-05-03 Thread Michael Stassen
mayuran wrote: This is my table: mysql desc testing; +---+--+--+-+-+---+ | Field | Type | Null | Key | Default | Extra | +---+--+--+-+-+---+ | date | date | YES | | NULL| | +---+--+--+-+-+---+

Re: WHERE clause problem

2004-05-03 Thread Paul DuBois
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| |