tt1212 > 08-07-18, 12:49 AM
SELECT t1.ngaythang,t1.tongtien,t1.tongthu,t1.datra,t1.conno FROM tbhoadon t1 JOIN (SELECT id,ngayxuat, max(id) as maxid, MAX(ngayxuat) max_date FROM tbhoadon GROUP BY ngayxuat ) t2 ON t1.ngayxuat = t2.max_date where t1.ngayxuat >='"&tungay&"' and t1.ngayxuat <= '"&denngay&"' GROUP BY t2.ngayxuat order by t1.ngayxuat asc