SELECT name_th , t1.nameP , t1.sm_pla_seed_sources , t1.s_pla_plant_area ,
(SELECT GROUP_CONCAT(DATE_FORMAT(date_date,'%d/%m/%Y') ORDER BY date_date) FROM db_data_subdate WHERE data_id = t1.id AND date_type = 1 GROUP by data_id) as date_sapling,
(SELECT GROUP_CONCAT(DATE_FORMAT(date_date,'%d/%m/%Y') ORDER BY date_date) FROM db_data_subdate WHERE data_id = t1.id AND date_type = 2 GROUP by data_id) as date_plant,
t1.last_update,
t1.sm_pla_plant_note
FROM db_list_centers
LEFT JOIN
(SELECT sv.name_th AS nameP ,
dc.sm_cor_centers ,
dd.sm_pla_seed_sources ,
dd.s_pla_plant_area ,
DATE_FORMAT(dd.last_update ,'%Y/%m/%d' '%H:%i:%S' ) AS last_update ,
dd.id ,
dd.sm_pla_plant_note
FROM db_data_cor dc, db_seed_varieties sv, db_data_data dd
WHERE DC.id=DD.cor_id AND dc.sm_cor_year= 2560 AND dd.type=1 AND dc.sm_cor_seed_varieties=sv.id
AND dc.sm_cor_season =2 ) AS t1 ON db_list_centers.id = t1.sm_cor_centers
elect t.* from
(select `กลุ่ม`, max(`วันที่`) as mx_dte from tablename group by `กลุ่ม`) tmp
left join tablename as t on t.`กลุ่ม` tmp.`กลุ่ม` and mx_dte=`วันที่`