發表文章

目前顯示的是 11月 27, 2018的文章

Calculate volumes based on date

圖片
up vote 1 down vote favorite I have this MariaDB table which I would like to use for bar chart: CREATE TABLE `payment_transaction_daily_facts` ( `id` int(11) NOT NULL AUTO_INCREMENT, `date` date DEFAULT NULL, `year` int(11) DEFAULT NULL, `month` int(11) DEFAULT NULL, `week` int(11) DEFAULT NULL, `day` int(11) DEFAULT NULL, `volume` int(11) DEFAULT NULL, `count` int(11) DEFAULT NULL, 'created_at' date DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB; In my example SQL query I have single column for Date. How I can calculate the volumes per day for last 10 days when I have split date, year, month, week and day into different columns? The final result should be for example: Date | Amount| Number of transactions per day | 11-11-2018 | 30 | 3 | 11-12-...