ไม่รู้ว่าใช่เปล่า
procedure TFtf.RzButton1Click(Sender: TObject);
begin
qtf.SQL.Text :=('SELECT co_office.off_name,(SUBSTRING(filename,11,8)) AS val FROM zreport_importstat INNER JOIN co_office ON zreport_importstat.pcucode = co_office.off_id where SUBSTRING(filename,11,8) between "'+(formatdatetime('yyyymmdd',RzDateTimeEdit1.Date))+'" and "'+(formatdatetime('yyyymmdd',RzDateTimeEdit2.Date))+'" group by pcucode ');
qtf.Open;
end;