php - Get last record of each month in MySQL....? -
i have problem in writing query mysql. have following fields in db id created_on status 1 2011-02-15 12:47:09 1 2 2011-02-24 12:47:09 1 3 2011-02-29 12:47:09 1 4 2011-03-11 12:47:09 1 5 2011-03-15 12:47:09 1 6 2011-03-22 12:47:09 1 7 2011-04-10 12:47:09 1 8 2011-04-11 12:47:09 1 i need select last record of each month . month feb record # 3 month march record # 6 , month april record # 8 please me..... thanks in advance..... select * table created_on in (select distinct max(created_on) table group year(created_on), month(created_on))