SELECT *,
CASE
WHEN(max(`priod_id`) > 4) THEN
"0.2"
ELSE
"0.25"
END AS PERCENTAGE,
COUNT(priod_id) as HOURS,
COUNT(CASE
WHEN nota_id = '1' THEN
1
END) AS PR
FROM `attendance_tbl` A
WHERE DATE(attend_date) BETWEEN DATE('2018-08-01') AND DATE('2018-08-31')
AND sid = '60'
GROUP BY DATE(attend_date)
我们需要将PERCENTAGE和PR相乘
(PERCENTAGE * PR)总计
请告诉我们一种解决查询的技术。
答案 0 :(得分:0)
一种方法是从现有scipy
查询的结果集中获取Derived Table。之后,您可以在派生表的外部SELECT
子句SELECT
中执行各种操作(例如:此处的乘法)。请尝试以下操作:
FROM