select a.*,concat(pt.pname,pt.fname,' ',pt.lname) ptname
,s.vstdate,s.creatinine,s.egfr
,if (egfr>=90,'1'
,if (egfr>=60,'2'
,if (egfr>=30,'3'
,if (egfr>=15,'4'
,if (egfr>0,'5',''))))) stage
from (select max(s.vn) vn,c.hn
from clinicmember c
left join opdscreen s on c.hn=s.hn
where s.vstdate between '2013-10-01' and '2013-12-31'
and c.clinic=001
and c.clinic_member_status_id=1
and s.creatinine>0
group by c.hn) a
left join patient pt on pt.hn=a.hn
left join opdscreen s on a.vn=s.vn
ถ้าเอาผล creatinine จาก opdscreen หล่ะ