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

105 lines
2.3 KiB
MySQL
Raw Permalink 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>
2023-04-27 04:24:55 +00:00
SELECT DISTINCT s.saler_code,
s.saler_name,
t.team_code,
t.team,
bm.department_code,
bm.department_name
2023-04-06 10:20:16 +00:00
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
2023-04-26 12:19:49 +00:00
AND s.saler_code = '61136';
2023-04-12 10:27:24 +00:00
SELECT *
FROM tele_saler_team t
WHERE t.team_code = '107077'
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,
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,
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,
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,
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>'
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;
----------------------------------------
/*
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>';
SELECT *
FROM BI<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϯ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʸ<EFBFBD><EFBFBD>ٱ<EFBFBD>
WHERE <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> = '<EFBFBD>ų<EFBFBD><EFBFBD><EFBFBD>';
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><EFBFBD><EFBFBD><EFBFBD>ʸ<EFBFBD><EFBFBD>ٱ<EFBFBD>;