Forums
 This topic is locked 
             Select Month Records
 Posted 17 Apr 2002  23:31:34 
  1 
     has   voted 
  17 Apr 2002  23:31:34 Stephen Bateman posted: 
 Does anyone know a way of selecting all records from a particular month from a date field in MySQL or a year,For example i thought the following may work but it does now <img src=../images/dmxzone/forum/icon_smile_sad.gif border=0 align=middle>
"SELECT * from table WHERE orderdate = '%-04-%"
Thanks
Stephen
Replies
 Replied 19 Apr 2002  08:18:56 
   19 Apr 2002  08:18:56 Owen Eastwick replied: 
  Try something like:
SELECT * FROM TableName WHERE DatePart("m", orderdate) = 4
Regards
Owen.
Multiple Parameter UD4 / Access 2000 Database Search Tutorial:
www.tdsf.co.uk/tdsfdemo
  SELECT * FROM TableName WHERE DatePart("m", orderdate) = 4
Regards
Owen.
Multiple Parameter UD4 / Access 2000 Database Search Tutorial:
www.tdsf.co.uk/tdsfdemo
 Replied 14 May 2002  10:27:35 
   14 May 2002  10:27:35 Julio Taylor replied: 
  this is what i think id the best solution:
SELECT * FROM table where MONTHNAME(orderdate) = 'April' (if you're using text months)
or
SELECT * FROM table where MONTH(orderdate) = 4
i'm quiote sure that this works.
-- J
P.S. i killed kenny
  SELECT * FROM table where MONTHNAME(orderdate) = 'April' (if you're using text months)
or
SELECT * FROM table where MONTH(orderdate) = 4
i'm quiote sure that this works.
-- J
P.S. i killed kenny