desktop_task_schedule/code/db/常用语句.sql

105 lines
2.3 KiB
MySQL
Raw Normal View History

2023-03-21 03:42:12 +00:00
SELECT *
FROM REWARD_GAINERS
2023-03-21 10:01:05 +00:00
FOR UPDATE;
SELECT B.REWARD_NAME,
A.*
FROM REWARD_GAINERS A,
REWARD_PROJECTS B
WHERE A.REWARD_INDEX = B.REWARD_INDEX;
2023-03-23 10:39:15 +00:00
2023-04-06 10:20:16 +00:00
--<EFBFBD><EFBFBD>ϯ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
SELECT DISTINCT S.SALER_CODE,
S.SALER_NAME,
T.TEAM_CODE,
T.TEAM,
BM.DEPARTMENT_CODE,
BM.DEPARTMENT_NAME
FROM TELE_SALER S,
TELE_SALER_TEAM T,
IDST0.BM_T BM
WHERE S.TEAM_CODE = T.TEAM_CODE
AND T.DEPARTMENT_CODE = BM.DEPARTMENT_CODE
AND S.SALER_CODE = '61136';
2023-04-12 10:27:24 +00:00
SELECT *
FROM TELE_SALER_TEAM T
WHERE T.TEAM_CODE = '107077'
2023-04-12 10:27:24 +00:00
SELECT *
2023-06-04 11:11:44 +00:00
FROM <EFBFBD><EFBFBD>ϯ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ÿ<EFBFBD>ձ<EFBFBD><EFBFBD><EFBFBD>
2023-04-12 10:27:24 +00:00
ORDER BY <EFBFBD><EFBFBD>ϯ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>,
ǩ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>;
2023-04-06 10:20:16 +00:00
2023-04-06 01:25:46 +00:00
SELECT <EFBFBD><EFBFBD><EFBFBD><EFBFBD>,
SUM(<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ۼ<EFBFBD>) <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,
SUM(<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>) <EFBFBD><EFBFBD><EFBFBD>ڱ<EFBFBD><EFBFBD><EFBFBD>,
ROUND((SUM(<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ۼ<EFBFBD>) / SUM(<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)) * 100,
2023-04-06 01:25:46 +00:00
0) || '%' <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
FROM <EFBFBD><EFBFBD>ϯ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͳ<EFBFBD><EFBFBD>
GROUP BY <EFBFBD><EFBFBD><EFBFBD><EFBFBD>;
2023-06-02 10:04:26 +00:00
--<EFBFBD><EFBFBD><EFBFBD>Ǹ<EFBFBD><EFBFBD><EFBFBD>ÿ<EFBFBD><EFBFBD>ҵ<EFBFBD><EFBFBD>
SELECT <EFBFBD>·<EFBFBD>,
<EFBFBD><EFBFBD><EFBFBD>Ŵ<EFBFBD><EFBFBD><EFBFBD>,
<EFBFBD><EFBFBD>ϯ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>,
SUM(<EFBFBD><EFBFBD><EFBFBD>ո<EFBFBD><EFBFBD>˿ͻ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>),
SUM(<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ںϱ<EFBFBD><EFBFBD><EFBFBD>),
ROUND(SUM(<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ںϱ<EFBFBD><EFBFBD><EFBFBD>) / SUM(<EFBFBD><EFBFBD><EFBFBD>ո<EFBFBD><EFBFBD>˿ͻ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>) * 100,
2023-06-02 10:04:26 +00:00
2) <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>͸<EFBFBD><EFBFBD>
2023-06-04 11:11:44 +00:00
FROM <EFBFBD><EFBFBD>ϯ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ÿ<EFBFBD>ձ<EFBFBD><EFBFBD><EFBFBD>
2023-06-02 10:04:26 +00:00
GROUP BY <EFBFBD>·<EFBFBD>,
<EFBFBD><EFBFBD><EFBFBD>Ŵ<EFBFBD><EFBFBD><EFBFBD>,
<EFBFBD><EFBFBD>ϯ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
2023-10-27 08:51:57 +00:00
HAVING <EFBFBD>·<EFBFBD> = '10<EFBFBD><EFBFBD>'
2023-06-02 10:04:26 +00:00
ORDER BY <EFBFBD><EFBFBD><EFBFBD>Ŵ<EFBFBD><EFBFBD><EFBFBD>,
<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>͸<EFBFBD><EFBFBD> DESC;
SELECT <EFBFBD><EFBFBD>ϯ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>,
ROUND(SUM(<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ںϱ<EFBFBD><EFBFBD><EFBFBD>) / SUM(<EFBFBD><EFBFBD><EFBFBD>ո<EFBFBD><EFBFBD>˿ͻ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>) * 100,
2023-06-02 10:04:26 +00:00
2) <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>͸<EFBFBD><EFBFBD>
2023-06-04 11:11:44 +00:00
FROM <EFBFBD><EFBFBD>ϯ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ÿ<EFBFBD>ձ<EFBFBD><EFBFBD><EFBFBD>
2023-06-02 10:04:26 +00:00
WHERE <EFBFBD><EFBFBD><EFBFBD>Ŵ<EFBFBD><EFBFBD><EFBFBD> = 'QDI'
2023-10-27 08:51:57 +00:00
AND <EFBFBD>·<EFBFBD> = '10'
2023-06-06 09:31:16 +00:00
AND <EFBFBD><EFBFBD><EFBFBD><EFBFBD> = '2023'
2023-06-02 10:04:26 +00:00
GROUP BY <EFBFBD><EFBFBD>ϯ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
ORDER BY <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>͸<EFBFBD><EFBFBD> DESC;
2023-06-04 11:11:44 +00:00
--<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
2023-06-06 09:31:16 +00:00
SELECT <EFBFBD><EFBFBD>ϯ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>,
ROUND(NVL(SUM(<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ۼ<EFBFBD>) / SUM(<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>) * 100,
2023-06-06 09:31:16 +00:00
0),
2) <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
FROM <EFBFBD><EFBFBD>ϯ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͳ<EFBFBD><EFBFBD> XB
WHERE XB.<EFBFBD><EFBFBD><EFBFBD><EFBFBD> = '<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ҵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>'
2023-06-06 09:31:16 +00:00
GROUP BY <EFBFBD><EFBFBD>ϯ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
ORDER BY <EFBFBD><EFBFBD>ϯ<EFBFBD><EFBFBD><EFBFBD><EFBFBD> DESC;
2023-10-27 08:51:57 +00:00
-------------------------------------
SELECT ZX.SALER_NAME,
BM.DEPARTMENT_NAME
FROM TELE_SALER ZX,
TELE_SALER_TEAM TEAM,
IDST0.BM_T BM
WHERE ZX.SALER_NAME = '<EFBFBD>ų<EFBFBD><EFBFBD><EFBFBD>'
AND ZX.TEAM_CODE = TEAM.TEAM_CODE
AND TEAM.DEPARTMENT_CODE = BM.DEPARTMENT_CODE;
2023-10-27 08:51:57 +00:00
----------------------------------------
/*
truncate table BI<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>͸<EFBFBD>ʸ<EFBFBD><EFBFBD>ٱ<EFBFBD>;
*/
SELECT *
FROM BI<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϯ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>͸<EFBFBD>ʸ<EFBFBD><EFBFBD>ٱ<EFBFBD> T
WHERE T.<EFBFBD><EFBFBD><EFBFBD><EFBFBD> = '<EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
2023-10-27 08:51:57 +00:00
SELECT *
FROM "BI<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϯ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʸ<EFBFBD><EFBFBD>ٱ<EFBFBD>-24<32><34>"
WHERE <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> = '<EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
2023-10-27 08:51:57 +00:00
SELECT *
FROM BI<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>͸<EFBFBD>ʸ<EFBFBD><EFBFBD>ٱ<EFBFBD>;
SELECT *
FROM "BI<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʸ<EFBFBD><EFBFBD>ٱ<EFBFBD>-24<32><34>";