BMS-HOSxP Community

HOSxP => แจ้งปัญหา / ขอความช่วยเหลือ => ข้อความที่เริ่มโดย: panus_t ที่ เมษายน 18, 2014, 15:17:13 PM

หัวข้อ: แก้ไข คำสั่ง MySQL ให้หน่อยครับ
เริ่มหัวข้อโดย: panus_t ที่ เมษายน 18, 2014, 15:17:13 PM
select v.*
from vn_stat v
left outer join patient p on p.hn=v.hn
left outer join clinicmember c on c.hn=v.hn
where vstdate between "2013-10-01" and "2014-01-31" and p.chwpart="30" and p.amppart="03" and p.tmbpart="01"

ต้องการหา
1.คนไข้ ที่อยู่ใน clinicmember
2.มารับบริการตั้งแต่ 1 ต.ค.56-31 ม.ค.57
3.ที่อยู่ จังหวัด อำเภอ ตำบล ที่กำหนด

ครับ ??? ??? ;D
หัวข้อ: Re: แก้ไข คำสั่ง MySQL ให้หน่อยครับ
เริ่มหัวข้อโดย: Tigger ที่ เมษายน 18, 2014, 15:56:18 PM
select v.*
from clinicmember c
left outer join patient p on p.hn=c.hn
left outer join vn_stat v on v.hn=c.hn
where vstdate between "2013-10-01" and "2013-10-01"
and p.chwpart="30" and p.amppart="08" and p.tmbpart="02"

ลองดูนะคะ ถ้าต้องการระบุคลินิกด้วยก้อใส่เงื่อนไขเพิ่ม c.clinic=001
หัวข้อ: Re: แก้ไข คำสั่ง MySQL ให้หน่อยครับ
เริ่มหัวข้อโดย: udomchok ที่ เมษายน 21, 2014, 12:46:13 PM
เอาแบบนี้ไปเลยดีไหมครับ
http://hosxp.net/index.php?option=com_smf&Itemid=28&topic=31775.0
หัวข้อ: Re: แก้ไข คำสั่ง MySQL ให้หน่อยครับ
เริ่มหัวข้อโดย: panus_t ที่ เมษายน 21, 2014, 16:23:13 PM
ขอบคุณครับ   ;D ;D ;D