BMS-HOSxP Community
HOSxP => แจ้งปัญหา / ขอความช่วยเหลือ => ข้อความที่เริ่มโดย: wiphusit ที่ พฤศจิกายน 30, 2009, 10:12:08 AM
-
ขอคำสั่งเลือกการมาครั้งสุดท้าย หน่อยครับ
select o.vstdate,o.hn,p.pname,p.fname,p.lname,o.bw,o.height,o.bmi,o.waist
from opdscreen o
left outer join patient p on p.hn=o.hn
where o.hn ="0012876"
-
select o.vstdate,o.hn,p.pname,p.fname,p.lname,o.bw,o.height,o.bmi,o.waist
from opdscreen o
left outer join patient p on p.hn=o.hn
where o.hn ="0012876"
order by vstdate,vsttime desc
limit 1
ลองดูครับ
-
ตก desc ไปอันนึง และเพิ่ม o.vsttime ให้ด้วย เสร็จแล้ว น่าจะเป็นแบบนี้ครับ
select o.vstdate, o.vsttime, o.hn,p.pname,p.fname,p.lname,o.bw,o.height,o.bmi,o.waist
from opdscreen o
left outer join patient p on p.hn=o.hn
where o.hn ="0012876"
order by vstdate desc,vsttime desc
limit 1
-
ตก desc ไปอันนึง และเพิ่ม o.vsttime ให้ด้วย เสร็จแล้ว น่าจะเป็นแบบนี้ครับ
select o.vstdate, o.vsttime, o.hn,p.pname,p.fname,p.lname,o.bw,o.height,o.bmi,o.waist
from opdscreen o
left outer join patient p on p.hn=o.hn
where o.hn ="0012876"
order by vstdate desc,vsttime desc
limit 1
ขอบคุณครับ
พอดีลืมรันโค้ดดูก่อน ;D ตกจนได้ อิอิ
-
ขอบคุณทุกท่านครับ
-
แล้วถ้าต้องการทีเดียวหลาย HN ทำไงครับ
-
select o.vstdate,o.hn,p.pname,p.fname,p.lname,o.bw,o.height,o.bmi,o.waist
from opdscreen o
left outer join patient p on p.hn=o.hn
where o.vstdate between "2009-10-01" and "2009-11-29"