existing SP tambahan (table pola kelainan dan hubungan penyakit)
This commit is contained in:
1440
sp_rpt_exe_sum_table_hubungan_penyakit.txt
Normal file
1440
sp_rpt_exe_sum_table_hubungan_penyakit.txt
Normal file
File diff suppressed because it is too large
Load Diff
45
sp_rpt_exe_sum_table_pola_kelainan.txt
Normal file
45
sp_rpt_exe_sum_table_pola_kelainan.txt
Normal file
@@ -0,0 +1,45 @@
|
||||
BEGIN
|
||||
WITH max AS (
|
||||
SELECT
|
||||
COUNT(*) AS maxAmount
|
||||
FROM
|
||||
one_etl.mgm_header
|
||||
WHERE
|
||||
Mgm_HeaderIsActive = 'Y'
|
||||
AND Mgm_HeaderType = 'L'
|
||||
AND Mgm_HeaderMgm_McuID = PID
|
||||
),
|
||||
perItem AS (
|
||||
SELECT
|
||||
COUNT(*) AS xTotalPerItem
|
||||
, Mcu_KelainanGroupName
|
||||
, Mgm_HeaderMgm_McuID
|
||||
FROM
|
||||
one_etl.mgm_header
|
||||
JOIN one_etl.mgm_detail
|
||||
ON Mgm_HeaderID = Mgm_DetailMgm_HeaderID
|
||||
AND Mgm_HeaderIsActive = 'Y'
|
||||
AND Mgm_DetailIsActive = 'Y'
|
||||
JOIN one_etl.mcu_kelainangroup
|
||||
ON Mgm_DetailMcu_KelainanGroupID = Mcu_KelainanGroupID
|
||||
AND Mcu_KelainanGroupIsActive = 'Y'
|
||||
WHERE
|
||||
Mgm_HeaderType = 'L'
|
||||
AND Mgm_HeaderMgm_McuID = PID
|
||||
GROUP BY
|
||||
Mgm_DetailMcu_KelainanGroupID
|
||||
ORDER BY
|
||||
xTotalPerItem DESC
|
||||
LIMIT
|
||||
0, 10
|
||||
)
|
||||
SELECT
|
||||
perItem.xTotalPerItem
|
||||
, perItem.Mcu_KelainanGroupName
|
||||
, perItem.Mgm_HeaderMgm_McuID
|
||||
, (perItem.xTotalPerItem / max.maxAmount) * 100 AS Percentage
|
||||
FROM
|
||||
perItem
|
||||
, max;
|
||||
|
||||
END
|
||||
Reference in New Issue
Block a user