ผู้เขียน หัวข้อ: อยากให้ค่าที่ว่างแสดงออกมาเป็นเลข 0  (อ่าน 3495 ครั้ง)

0 สมาชิก และ 1 บุคคลทั่วไป กำลังดูหัวข้อนี้

ออฟไลน์ yokyai

  • Hero Member
  • *****
  • กระทู้: 1,462
  • Respect: +9
    • ดูรายละเอียด
อยากให้ค่าที่ว่างแสดงออกมาเป็นเลข 0
« เมื่อ: พฤศจิกายน 21, 2011, 14:17:48 PM »
0
ถ้าเขียนสคริปต์รายงานตามด้านล่างใน report designer กรณีที่ไม่มีค่าอยากให้เลขออกมาเป็น 0 แต่ค่าออกมาเป็นค่าว่างทำอย่างไร แต่ถ้า query ปกติในสายฟ้าเลขจะออกมาเป็น 0

set @d1="2008-10-22";
set @d2="2008-11-21";
select a.*,b.IPD,c.OPERATION,d.LR,e.REFEROUT,f.REFERIN
from(select vstdate
,sum(if(main_dep in ("036","006","007","008","009"),1,0)) as "OPD"
,sum(if(main_dep ="011",1,0)) as "ER"
,sum(if(main_dep ="021",1,0)) as "DENT"
,sum(if(main_dep ="023",1,0)) as "SS"
,count(distinct vn) as "TOTALALL"
from ovst
where vstdate between @d1 and @d2
group by vstdate) a
left join
(select dchdate,count(distinct an) as "IPD"
from ipt
where dchdate between @d1 and @d2
group by dchdate) b on b.dchdate=a.vstdate
left join
(select request_operation_date,count(operation_id) as "OPERATION"
from operation_list
where request_operation_date between @d1 and @d2
group by request_operation_date) c on c.request_operation_date=a.vstdate
left join
(select o.vstdate,count(ip.an)+count(o.vn)  as "LR"
from ipt_pregnancy ip
left outer join ovst o on o.vstdate=ip.labor_date
where o.vstdate between @d1 and @d2 and o.main_dep="014"
group by o.vstdate) d on d.vstdate=a.vstdate
left join
(select refer_date,count(vn) as "REFEROUT"
from referout
where refer_date between @d1 and @d2
group by refer_date) e on e.refer_date=a.vstdate
left join
(select refer_date,count(vn) as "REFERIN"
from referin
where refer_date between @d1 and @d2
group by refer_date) f on f.refer_date=a.vstdate
Sakaowrat Choocherd(Administrator) Information Technologist
Bangyai Hospital(30 beds)
HOSxP = 16_May_2008
Master and Slave : DELL-R730 Server Intel Xeon 8Core(2Units)
,Ram64 GB,HDD600(10k)x4,Raid5,CentOS 7.0 64 bit
,MySQL 10.1.10-MariaDB
(3 March 2016) With BMSxTraBackupGUI

ออฟไลน์ nahos

  • Hero Member
  • *****
  • กระทู้: 2,216
  • รพ.นาแห้ว
  • Respect: +7
    • ดูรายละเอียด
    • รพ.นาแห้ว
Re: อยากให้ค่าที่ว่างแสดงออกมาเป็นเลข 0
« ตอบกลับ #1 เมื่อ: พฤศจิกายน 21, 2011, 14:34:50 PM »
0
ใน Report Design ลองกำหนดประเภทเป็น interger ดูครับ
ถ้าำคำถามท่านได้คำตอบที่ต้องการจากอาจารย์ท่านใด กรุณากด Thank เบา ๆ ^ ถูกใจกด [applaud] ไม่ชอบใจกด[smite]
>> การโพสต์ขอรายงานที่ดี <<
อ่านซักนิด ถามยังไงให้ได้คำตอบ ? :)
วิธีแสดงตัวว่าเป็นใคร โดย อ.อ๊อด (ให้ข้อมูลว่าเป็นใคร ปฏิบัติงานที่ไหน ใช้ server อะไร OS อะไร HOsxp Vไหน)
ก่อนที่จะตั้งกระทู้ถาม ลองค้นจากกระทู้เก่าดูก่อนไหม จะได้คำตอบเร็วกว่าการรอคำตอบนะ
..........................................................................
เจษ จพ.เภสัชกรรมฯ user@ NAHAEO HOSPITAL LOEI. <br>  Supervise by DANSAI HOSPITAL LOEI. <br>
Start 01/03/2550
=> Server IBM X3200 Ram 6 Gb. OS:Cent OS 6.0  
=> Client 20 client  OS: SP2  => HosXP Version <b>3.56.11.19</b>
-----------------------------
น้ำเต็มแก้ว "การเรียนรู้ไม่มีที่สิ้นสุด"

ออฟไลน์ yokyai

  • Hero Member
  • *****
  • กระทู้: 1,462
  • Respect: +9
    • ดูรายละเอียด
Re: อยากให้ค่าที่ว่างแสดงออกมาเป็นเลข 0
« ตอบกลับ #2 เมื่อ: พฤศจิกายน 22, 2011, 10:54:49 AM »
0
ใช้ DBText ครับเรียก interger ได้อย่างไรครับ
ขอบคุณครับ
Sakaowrat Choocherd(Administrator) Information Technologist
Bangyai Hospital(30 beds)
HOSxP = 16_May_2008
Master and Slave : DELL-R730 Server Intel Xeon 8Core(2Units)
,Ram64 GB,HDD600(10k)x4,Raid5,CentOS 7.0 64 bit
,MySQL 10.1.10-MariaDB
(3 March 2016) With BMSxTraBackupGUI

ออฟไลน์ yokyai

  • Hero Member
  • *****
  • กระทู้: 1,462
  • Respect: +9
    • ดูรายละเอียด
Re: อยากให้ค่าที่ว่างแสดงออกมาเป็นเลข 0
« ตอบกลับ #3 เมื่อ: พฤศจิกายน 22, 2011, 10:56:53 AM »
0
แต่ลองใช้ variable แล้ว pipline มาได้ครับขอบคุณสำหรับแนวทางครับ
Sakaowrat Choocherd(Administrator) Information Technologist
Bangyai Hospital(30 beds)
HOSxP = 16_May_2008
Master and Slave : DELL-R730 Server Intel Xeon 8Core(2Units)
,Ram64 GB,HDD600(10k)x4,Raid5,CentOS 7.0 64 bit
,MySQL 10.1.10-MariaDB
(3 March 2016) With BMSxTraBackupGUI