Sqltrace 3.55.4.20 ที่แสดงรายชื่อได้ถูกต้อง
select o.vn,o.hn,o.paid_money,concat(p.pname,p.fname,' ',p.lname) as ptname, v.vsttime, count(d.vn) as doctor_count, count(r.vn) as rx_count ,count(i.vn) as ipt_count from vn_stat o left outer join pq_doctor d on d.vn=o.vn left outer join rx_operator r on r.vn=o.vn left outer join rcpt_print i on i.vn=o.vn left outer join patient p on p.hn=o.hn left outer join ovst v on v.vn=o.vn where o.vstdate='2012-10-24' and o.vn not in (select vn from rcpt_print where bill_date_time between '2012-10-24 00:00:00' and '2012-10-24 23:59:59' and bill_amount>0 ) and o.paid_money > 0 group by o.vn,o.hn,o.paid_money ,p.pname,p.fname,p.lname ,v.vsttime having (count(d.vn)>0 or count(r.vn)>0 ) order by o.vn
select c.* ,t.hn,k.department,concat(p.pname,p.fname,' ',p.lname) as ptname from incith_cashier c left outer join kskdepartment k on k.depcode = c.send_depcode left outer join ipt t on t.an = c.an left outer join patient p on p.hn = t.hn where c.print_rcpt = 'N' order by c.send_date_time desc
select o.vn,o.hn,o.paid_money,concat(p.pname,p.fname,' ',p.lname) as ptname, v.vsttime, count(d.vn) as doctor_count, count(r.vn) as rx_count ,count(i.vn) as ipt_count from vn_stat o left outer join pq_doctor d on d.vn=o.vn left outer join rx_operator r on r.vn=o.vn left outer join rcpt_print i on i.vn=o.vn left outer join patient p on p.hn=o.hn left outer join ovst v on v.vn=o.vn where o.vstdate='2012-10-24' and o.vn in (select vn from rcpt_print where bill_date_time between '2012-10-24 00:00:00' and '2012-10-24 23:59:59' and bill_amount>0 ) and o.paid_money > 0 group by o.vn,o.hn,o.paid_money ,p.pname,p.fname,p.lname ,v.vsttime having (count(d.vn)>0 or count(r.vn)>0 ) order by o.vn
select department from kskdepartment order by department
select name from spclty
select o.vn,o.hn,o.paid_money,concat(p.pname,p.fname,' ',p.lname) as ptname, v.vsttime, count(d.vn) as doctor_count, count(r.vn) as rx_count ,count(i.vn) as ipt_count from vn_stat o left outer join pq_doctor d on d.vn=o.vn left outer join rx_operator r on r.vn=o.vn left outer join rcpt_print i on i.vn=o.vn left outer join patient p on p.hn=o.hn left outer join ovst v on v.vn=o.vn where o.vstdate='2012-10-24' and o.vn in (select vn from rcpt_print where bill_date_time between '2012-10-24 00:00:00' and '2012-10-24 23:59:59' and bill_amount>0 ) and o.paid_money > 0 group by o.vn,o.hn,o.paid_money ,p.pname,p.fname,p.lname ,v.vsttime having (count(d.vn)>0 or count(r.vn)>0 ) order by o.vn
Sqltrace 3.55.10.24 ที่แสดงรายชื่อผิด
select c.* ,t.hn,k.department,concat(p.pname,p.fname,' ',p.lname) as ptname from incith_cashier c left outer join kskdepartment k on k.depcode = c.send_depcode left outer join ipt t on t.an = c.an left outer join patient p on p.hn = t.hn where c.print_rcpt = 'N' order by c.send_date_time desc
select o.vn,o.hn,o.paid_money,concat(p.pname,p.fname,' ',p.lname) as ptname, v.vsttime, count(d.vn) as doctor_count, count(r.vn) as rx_count ,count(i.vn) as ipt_count from vn_stat o left outer join pq_doctor d on d.vn=o.vn left outer join rx_operator r on r.vn=o.vn left outer join rcpt_print i on i.vn=o.vn left outer join patient p on p.hn=o.hn left outer join ovst v on v.vn=o.vn where o.vstdate='2012-10-24' and o.vn not in (select vn from rcpt_print where bill_date_time between '2012-10-24 00:00:00' and '2012-10-24 23:59:59' and bill_amount>0 ) and (o.remain_money+o.rcpt_money+o.uc_money)<o.paid_money and o.paid_money > 0 group by o.vn,o.hn,o.paid_money ,p.pname,p.fname,p.lname ,v.vsttime having (count(d.vn)>0 or count(r.vn)>0 ) order by o.vn
select department from kskdepartment order by department
select name from spclty
select o.vn,o.hn,o.paid_money,concat(p.pname,p.fname,' ',p.lname) as ptname, v.vsttime, count(d.vn) as doctor_count, count(r.vn) as rx_count ,count(i.vn) as ipt_count from vn_stat o left outer join pq_doctor d on d.vn=o.vn left outer join rx_operator r on r.vn=o.vn left outer join rcpt_print i on i.vn=o.vn left outer join patient p on p.hn=o.hn left outer join ovst v on v.vn=o.vn where o.vstdate='2012-10-24' and o.vn not in (select vn from rcpt_print where bill_date_time between '2012-10-24 00:00:00' and '2012-10-24 23:59:59' and bill_amount>0 ) and (o.remain_money+o.rcpt_money+o.uc_money)<o.paid_money and o.paid_money > 0 group by o.vn,o.hn,o.paid_money ,p.pname,p.fname,p.lname ,v.vsttime having (count(d.vn)>0 or count(r.vn)>0 ) order by o.vn
จากเงื่อนไข and (o.remain_money+o.rcpt_money+o.uc_money)<o.paid_money ถ้าเป็นผู้ป่วยสิทธิ์ 30 บาทที่ต้องจ่ายค่าธรรมเนียมสิทธิ 30 บาท ยังไงก็ไม่แสดงเพราะ o.paid_money=30 แต่ o.remain_money+o.rcpt_money+o.uc_money มากกว่า 30 เพราะ uc_money เป็นลูกหนี้สิทธิ์ที่รวมค่าใช้จ่ายหมวดต่างๆเข้าด้วยกัน---->รบกวน อ.MN แก้ไขด้วยครับ ปัญหานี้พบมานานมากแล้วตั้งแต่ 3.55.4.25 ครับ