Dear All,
Can we use custom SQL that generated on the fly?
I try to use view, generated error when save : The connected table does NOT have a primary key, please add a primary key to your table or some functions will not work correctly
Can we use custom SQL that generated on the fly?
I try to use view, generated error when save : The connected table does NOT have a primary key, please add a primary key to your table or some functions will not work correctly
SELECT DATE_FORMAT(date_8,'%d-%m-%Y') as date_t, txt_region, sum(IF(`shift`=1,`lalin`,0)) AS lalin_s_1, sum(IF(`shift`=2,`lalin`,0)) AS lalin_s_2, sum(IF(`shift`=3,`lalin`,0)) AS lalin_s_3, sum(IF(`shift`=1,`tunai`,0)) AS tunai_s_1, sum(IF(`shift`=2,`tunai`,0)) AS tunai_s_2, sum(IF(`shift`=3,`tunai`,0)) AS tunai_s_3, sum(IF(`shift`=1,`ppc`,0)) AS ppc_s_1, sum(IF(`shift`=2,`ppc`,0)) AS ppc_s_2, sum(IF(`shift`=3,`ppc`,0)) AS ppc_s_3, sum(`lalin`) AS total_lalin, sum(`tunai`) AS total_tunai, sum(`ppc`) AS total_ppc FROM `ctc320_hpt` where cf_user_id = "???????" <----- dynamic group by date(date_8),txt_regionmy table
CREATE TABLE IF NOT EXISTS `ctc320_hpt` ( `cf_id` int(11) NOT NULL AUTO_INCREMENT, `uid` varchar(255) NOT NULL, `recordtime` text NOT NULL, `ipaddress` text NOT NULL, `cf_user_id` text NOT NULL, `date_8` date NOT NULL, `txt_region` varchar(255) NOT NULL, `Lalin` varchar(255) NOT NULL, `tunai` varchar(255) NOT NULL, `PPC` varchar(255) NOT NULL, `shift` varchar(255) NOT NULL, `note` varchar(255) NOT NULL, PRIMARY KEY (`cf_id`) )