CREATE DEFINER=`root`@`localhost` PROCEDURE `Select_lampiran`(IN `p_id` INT, IN `bulan` INT, IN `tahun` INT,
IN `kodeapp` VARCHAR(255), IN `kodeuser` VARCHAR(255))
BEGIN
SET SESSION group_concat_max_len = 1000000;
SET @sql1=(
SELECT GROUP_CONCAT(
DISTINCT 'MAX(IF(DAY(tbabsenpeg.tgl)=',id,',
TIME_TO_SEC(TIMEDIFF(tbabsenpeg.masuk,tbjamguru.masuk)),
IF(tbjammasukguru.hari=DAYNAME(tbabsenpeg.tgl),
TIME_TO_SEC(TIMEDIFF(tbabsenpeg.masuk, tbjammasukguru.masuk)),""))) AS masuk',id
)
)
FROM tbtgl
WHERE id <= p_id
);
如果分支存在问题。如果将执行表tbjamguru (TIME_TO_SEC(TIMEDIFF(tbabsenpeg.masuk,tbjamguru.masuk)))
中显示的数据。其他TIME_TO_SEC(TIMEDIFF(tbabsenpeg.masuk, tbjammasukguru.masuk))
将被执行。