|
|
@@ -147,7 +147,7 @@
|
|
|
SELECT QUARTER(d.first_cost_day) quaterTime,
|
|
|
DATE_FORMAT(d.first_cost_day, '%Y') yearTime,
|
|
|
DATE_FORMAT(d.first_cost_day, '%m') monthTime,
|
|
|
- IFNULL(sum(d.cost), 0) AS cost,
|
|
|
+ IFNULL(ROUND(SUM(d.cost), 2), 0) AS cost,
|
|
|
'0.3' AS coefficient,
|
|
|
IFNULL(round((sum(d.cost) * 0.002 * 0.3), 3), 0) AS commission,
|
|
|
'clip' AS type
|
|
|
@@ -161,7 +161,7 @@
|
|
|
SELECT QUARTER(d.first_cost_day) quaterTime,
|
|
|
DATE_FORMAT(d.first_cost_day, '%Y') yearTime,
|
|
|
DATE_FORMAT(d.first_cost_day, '%m') monthTime,
|
|
|
- IFNULL(sum(d.cost), 0) AS cost,
|
|
|
+ IFNULL(ROUND(SUM(d.cost), 2), 0) AS cost,
|
|
|
'0.1' AS coefficient,
|
|
|
IFNULL(round((sum(d.cost) * 0.002 * 0.1), 3), 0) AS commission,
|
|
|
'shot' AS type
|
|
|
@@ -175,7 +175,7 @@
|
|
|
SELECT QUARTER(d.first_cost_day) quaterTime,
|
|
|
DATE_FORMAT(d.first_cost_day, '%Y') yearTime,
|
|
|
DATE_FORMAT(d.first_cost_day, '%m') monthTime,
|
|
|
- IFNULL(sum(d.cost), 0) AS cost,
|
|
|
+ IFNULL(ROUND(SUM(d.cost), 2), 0) AS cost,
|
|
|
'0.4' AS coefficient,
|
|
|
IFNULL(round((sum(d.cost) * 0.002 * 0.4), 3), 0) AS commission,
|
|
|
'plan' AS type
|
|
|
@@ -193,7 +193,7 @@
|
|
|
SELECT QUARTER(d.first_cost_day) quaterTime,
|
|
|
DATE_FORMAT(d.first_cost_day, '%Y') yearTime,
|
|
|
DATE_FORMAT(d.first_cost_day, '%m') monthTime,
|
|
|
- IFNULL(sum(d.charge), 0) AS cost,
|
|
|
+ IFNULL(ROUND(SUM(d.charge), 2), 0) AS cost,
|
|
|
'0.3' AS coefficient,
|
|
|
IFNULL(round((sum(d.charge) * 0.003 * 0.3), 3), 0) AS commission,
|
|
|
'clip' AS type
|
|
|
@@ -207,7 +207,7 @@
|
|
|
SELECT QUARTER(d.first_cost_day) quaterTime,
|
|
|
DATE_FORMAT(d.first_cost_day, '%Y') yearTime,
|
|
|
DATE_FORMAT(d.first_cost_day, '%m') monthTime,
|
|
|
- IFNULL(sum(d.charge), 0) AS cost,
|
|
|
+ IFNULL(ROUND(SUM(d.charge), 2), 0) AS cost,
|
|
|
'0.1' AS coefficient,
|
|
|
IFNULL(round((sum(d.charge) * 0.003 * 0.1), 3), 0) AS commission,
|
|
|
'shot' AS type
|
|
|
@@ -221,7 +221,7 @@
|
|
|
SELECT QUARTER(d.first_cost_day) quaterTime,
|
|
|
DATE_FORMAT(d.first_cost_day, '%Y') yearTime,
|
|
|
DATE_FORMAT(d.first_cost_day, '%m') monthTime,
|
|
|
- IFNULL(sum(d.charge), 0) AS cost,
|
|
|
+ IFNULL(ROUND(SUM(d.charge), 2), 0) AS cost,
|
|
|
'0.4' AS coefficient,
|
|
|
IFNULL(round((sum(d.charge) * 0.003 * 0.4), 3), 0) AS commission,
|
|
|
'plan' AS type
|
|
|
@@ -238,7 +238,7 @@
|
|
|
SELECT QUARTER(#{startTime}) AS 'quaterTime',
|
|
|
YEAR (
|
|
|
#{startTime}) AS 'yearTime',
|
|
|
- IFNULL(SUM( d.cost ), 0 ) AS 'cost',
|
|
|
+ IFNULL(ROUND(SUM(d.cost), 2), 0) AS 'cost',
|
|
|
'byteDance' AS 'type'
|
|
|
FROM
|
|
|
application.bytedance_material_cost_daily d
|
|
|
@@ -258,7 +258,7 @@
|
|
|
SELECT QUARTER(#{startTime}) AS 'quaterTime',
|
|
|
YEAR (
|
|
|
#{startTime}) AS 'yearTime',
|
|
|
- IFNULL( SUM( d.charge ), 0 ) AS 'cost',
|
|
|
+ IFNULL(ROUND(SUM(d.charge), 2), 0) AS 'cost',
|
|
|
'kuaiShou' AS 'type'
|
|
|
FROM
|
|
|
application.kuaishou_material_cost_daily d
|
|
|
@@ -386,7 +386,7 @@
|
|
|
select *
|
|
|
FROM (
|
|
|
SELECT DATE_FORMAT(#{month1.startTime}, '%m') monthTime,
|
|
|
- IFNULL(sum(d.cost), 0) AS cost,
|
|
|
+ IFNULL(ROUND(SUM(d.cost), 2), 0) AS cost,
|
|
|
'0.3' AS coefficient,
|
|
|
IFNULL(round((sum(d.cost) * 0.002 * 0.3), 3), 0) AS commission,
|
|
|
'clip' AS type
|
|
|
@@ -398,7 +398,7 @@
|
|
|
AND d.first_cost_day <= #{month1.endTime}
|
|
|
UNION
|
|
|
SELECT DATE_FORMAT(#{month1.startTime}, '%m') monthTime,
|
|
|
- IFNULL(sum(d.cost), 0) AS cost,
|
|
|
+ IFNULL(ROUND(SUM(d.cost), 2), 0) AS cost,
|
|
|
'0.1' AS coefficient,
|
|
|
IFNULL(round((sum(d.cost) * 0.002 * 0.1), 3), 0) AS commission,
|
|
|
'shot' AS type
|
|
|
@@ -410,7 +410,7 @@
|
|
|
AND d.first_cost_day <= #{month1.endTime}
|
|
|
UNION
|
|
|
SELECT DATE_FORMAT(#{month1.startTime}, '%m') monthTime,
|
|
|
- IFNULL(sum(d.cost), 0) AS cost,
|
|
|
+ IFNULL(ROUND(SUM(d.cost), 2), 0) AS cost,
|
|
|
'0.4' AS coefficient,
|
|
|
IFNULL(round((sum(d.cost) * 0.002 * 0.4), 3), 0) AS commission,
|
|
|
'plan' AS type
|
|
|
@@ -422,7 +422,7 @@
|
|
|
AND d.first_cost_day <= #{month1.endTime}
|
|
|
UNION
|
|
|
SELECT DATE_FORMAT(#{month2.startTime}, '%m') monthTime,
|
|
|
- IFNULL(sum(d.cost), 0) AS cost,
|
|
|
+ IFNULL(ROUND(SUM(d.cost), 2), 0) AS cost,
|
|
|
'0.3' AS coefficient,
|
|
|
IFNULL(round((sum(d.cost) * 0.002 * 0.3), 3), 0) AS commission,
|
|
|
'clip' AS type
|
|
|
@@ -434,7 +434,7 @@
|
|
|
AND d.first_cost_day <= #{month2.endTime}
|
|
|
UNION
|
|
|
SELECT DATE_FORMAT(#{month2.startTime}, '%m') monthTime,
|
|
|
- IFNULL(sum(d.cost), 0) AS cost,
|
|
|
+ IFNULL(ROUND(SUM(d.cost), 2), 0) AS cost,
|
|
|
'0.1' AS coefficient,
|
|
|
IFNULL(round((sum(d.cost) * 0.002 * 0.1), 3), 0) AS commission,
|
|
|
'shot' AS type
|
|
|
@@ -446,7 +446,7 @@
|
|
|
AND d.first_cost_day <= #{month2.endTime}
|
|
|
UNION
|
|
|
SELECT DATE_FORMAT(#{month2.startTime}, '%m') monthTime,
|
|
|
- IFNULL(sum(d.cost), 0) AS cost,
|
|
|
+ IFNULL(ROUND(SUM(d.cost), 2), 0) AS cost,
|
|
|
'0.4' AS coefficient,
|
|
|
IFNULL(round((sum(d.cost) * 0.002 * 0.4), 3), 0) AS commission,
|
|
|
'plan' AS type
|
|
|
@@ -458,7 +458,7 @@
|
|
|
AND d.first_cost_day <= #{month2.endTime}
|
|
|
UNION
|
|
|
SELECT DATE_FORMAT(#{month3.startTime}, '%m') monthTime,
|
|
|
- IFNULL(sum(d.cost), 0) AS cost,
|
|
|
+ IFNULL(ROUND(SUM(d.cost), 2), 0) AS cost,
|
|
|
'0.3' AS coefficient,
|
|
|
IFNULL(round((sum(d.cost) * 0.002 * 0.3), 3), 0) AS commission,
|
|
|
'clip' AS type
|
|
|
@@ -470,7 +470,7 @@
|
|
|
AND d.first_cost_day <= #{month3.endTime}
|
|
|
UNION
|
|
|
SELECT DATE_FORMAT(#{month3.startTime}, '%m') monthTime,
|
|
|
- IFNULL(sum(d.cost), 0) AS cost,
|
|
|
+ IFNULL(ROUND(SUM(d.cost), 2), 0) AS cost,
|
|
|
'0.1' AS coefficient,
|
|
|
IFNULL(round((sum(d.cost) * 0.002 * 0.1), 3), 0) AS commission,
|
|
|
'shot' AS type
|
|
|
@@ -482,7 +482,7 @@
|
|
|
AND d.first_cost_day <= #{month3.endTime}
|
|
|
UNION
|
|
|
SELECT DATE_FORMAT(#{month3.startTime}, '%m') monthTime,
|
|
|
- IFNULL(sum(d.cost), 0) AS cost,
|
|
|
+ IFNULL(ROUND(SUM(d.cost), 2), 0) AS cost,
|
|
|
'0.4' AS coefficient,
|
|
|
IFNULL(round((sum(d.cost) * 0.002 * 0.4), 3), 0) AS commission,
|
|
|
'plan' AS type
|
|
|
@@ -502,7 +502,7 @@
|
|
|
select *
|
|
|
FROM (
|
|
|
SELECT DATE_FORMAT(#{month1.startTime}, '%m') monthTime,
|
|
|
- IFNULL(sum(d.charge), 0) AS cost,
|
|
|
+ IFNULL(ROUND(SUM(d.charge), 2), 0) AS cost,
|
|
|
'0.3' AS coefficient,
|
|
|
IFNULL(round((sum(d.charge) * 0.003 * 0.3), 3), 0) AS commission,
|
|
|
'clip' AS type
|
|
|
@@ -514,7 +514,7 @@
|
|
|
AND d.first_cost_day <= #{month1.endTime}
|
|
|
UNION
|
|
|
SELECT DATE_FORMAT(#{month1.startTime}, '%m') monthTime,
|
|
|
- IFNULL(sum(d.charge), 0) AS cost,
|
|
|
+ IFNULL(ROUND(SUM(d.charge), 2), 0) AS cost,
|
|
|
'0.1' AS coefficient,
|
|
|
IFNULL(round((sum(d.charge) * 0.003 * 0.1), 3), 0) AS commission,
|
|
|
'shot' AS type
|
|
|
@@ -526,7 +526,7 @@
|
|
|
AND d.first_cost_day <= #{month1.endTime}
|
|
|
UNION
|
|
|
SELECT DATE_FORMAT(#{month1.startTime}, '%m') monthTime,
|
|
|
- IFNULL(sum(d.charge), 0) AS cost,
|
|
|
+ IFNULL(ROUND(SUM(d.charge), 2), 0) AS cost,
|
|
|
'0.4' AS coefficient,
|
|
|
IFNULL(round((sum(d.charge) * 0.003 * 0.4), 3), 0) AS commission,
|
|
|
'plan' AS type
|
|
|
@@ -538,7 +538,7 @@
|
|
|
AND d.first_cost_day <= #{month1.endTime}
|
|
|
UNION
|
|
|
SELECT DATE_FORMAT(#{month2.startTime}, '%m') monthTime,
|
|
|
- IFNULL(sum(d.charge), 0) AS cost,
|
|
|
+ IFNULL(ROUND(SUM(d.charge), 2), 0) AS cost,
|
|
|
'0.3' AS coefficient,
|
|
|
IFNULL(round((sum(d.charge) * 0.003 * 0.3), 3), 0) AS commission,
|
|
|
'clip' AS type
|
|
|
@@ -550,7 +550,7 @@
|
|
|
AND d.first_cost_day <= #{month2.endTime}
|
|
|
UNION
|
|
|
SELECT DATE_FORMAT(#{month2.startTime}, '%m') monthTime,
|
|
|
- IFNULL(sum(d.charge), 0) AS cost,
|
|
|
+ IFNULL(ROUND(SUM(d.charge), 2), 0) AS cost,
|
|
|
'0.1' AS coefficient,
|
|
|
IFNULL(round((sum(d.charge) * 0.003 * 0.1), 3), 0) AS commission,
|
|
|
'shot' AS type
|
|
|
@@ -562,7 +562,7 @@
|
|
|
AND d.first_cost_day <= #{month2.endTime}
|
|
|
UNION
|
|
|
SELECT DATE_FORMAT(#{month2.startTime}, '%m') monthTime,
|
|
|
- IFNULL(sum(d.charge), 0) AS cost,
|
|
|
+ IFNULL(ROUND(SUM(d.charge), 2), 0) AS cost,
|
|
|
'0.4' AS coefficient,
|
|
|
IFNULL(round((sum(d.charge) * 0.003 * 0.4), 3), 0) AS commission,
|
|
|
'plan' AS type
|
|
|
@@ -574,7 +574,7 @@
|
|
|
AND d.first_cost_day <= #{month2.endTime}
|
|
|
UNION
|
|
|
SELECT DATE_FORMAT(#{month3.startTime}, '%m') monthTime,
|
|
|
- IFNULL(sum(d.charge), 0) AS cost,
|
|
|
+ IFNULL(ROUND(SUM(d.charge), 2), 0) AS cost,
|
|
|
'0.3' AS coefficient,
|
|
|
IFNULL(round((sum(d.charge) * 0.003 * 0.3), 3), 0) AS commission,
|
|
|
'clip' AS type
|
|
|
@@ -586,7 +586,7 @@
|
|
|
AND d.first_cost_day <= #{month3.endTime}
|
|
|
UNION
|
|
|
SELECT DATE_FORMAT(#{month3.startTime}, '%m') monthTime,
|
|
|
- IFNULL(sum(d.charge), 0) AS cost,
|
|
|
+ IFNULL(ROUND(SUM(d.charge), 2), 0) AS cost,
|
|
|
'0.1' AS coefficient,
|
|
|
IFNULL(round((sum(d.charge) * 0.003 * 0.1), 3), 0) AS commission,
|
|
|
'shot' AS type
|
|
|
@@ -598,7 +598,7 @@
|
|
|
AND d.first_cost_day <= #{month3.endTime}
|
|
|
UNION
|
|
|
SELECT DATE_FORMAT(#{month3.startTime}, '%m') monthTime,
|
|
|
- IFNULL(sum(d.charge), 0) AS cost,
|
|
|
+ IFNULL(ROUND(SUM(d.charge), 2), 0) AS cost,
|
|
|
'0.4' AS coefficient,
|
|
|
IFNULL(round((sum(d.charge) * 0.003 * 0.4), 3), 0) AS commission,
|
|
|
'plan' AS type
|