Code ตรงจำนวนคนผิดหรือเปล่าครับ
น่าจะเป็น count(distinct(hn)) นะครับ
if gl1='OPD' then
begin
Value := GetSQLIntegerData('select count(distinct(vn)) as c_an from vn_stat'+
' where vstdate between "'+ds1+'" and "'+ds2+'"'+
' and lastvisit <=28 and substring(pdx,1,3) between "E10" and "E14"');
end else
if gl1='IPD' then
Value := GetSQLIntegerData('select count(distinct(an)) as c_an from an_stat'+
' where regdate between "'+ds1+'" and "'+ds2+'"'+
' and lastvisit <=28 and substring(pdx,1,3) between "E10" and "E14"');
end;
end;