Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
doc
/
ht_project_doc
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 2d80ae09
authored
Jun 10, 2026
by
周立明
Browse Files
Options
Browse Files
Tag
Download
Plain Diff
Merge branch 'master' of
http://192.168.3.233:8090/doc/ht_project_doc
2 parents
ed546bd4
213bc78b
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
38 additions
and
0 deletions
14_v5.8.2_20260615/sql/DML/scrm_shopmall_dml.sql
14_v5.8.2_20260615/sql/DML/scrm_shopmall_dml.sql
0 → 100644
View file @
2d80ae0
-- 将符合条件的、只有一条记录的订单的 sunshine_type 设为 1
UPDATE
scrm_shopmall
.
shopmall_staff_motivation
t
JOIN
(
SELECT
order_code
,
MIN
(
id
)
AS
keep_id
FROM
scrm_shopmall
.
shopmall_staff_motivation
WHERE
deleted_flag
=
'N'
AND
generate_type
=
0
AND
(
status
=
1
OR
(
status
=
2
AND
refund_type
=
1
))
GROUP
BY
order_code
HAVING
COUNT
(
*
)
=
1
)
tmp
ON
t
.
order_code
=
tmp
.
order_code
AND
t
.
id
=
tmp
.
keep_id
SET
t
.
sunshine_type
=
1
;
-- 先将所有有2条记录的订单中 id 较小的那条设为 1
UPDATE
scrm_shopmall
.
shopmall_staff_motivation
t
JOIN
(
SELECT
order_code
,
MIN
(
id
)
AS
min_id
FROM
scrm_shopmall
.
shopmall_staff_motivation
WHERE
deleted_flag
=
'N'
AND
generate_type
=
0
AND
(
status
=
1
OR
(
status
=
2
AND
refund_type
=
1
))
GROUP
BY
order_code
HAVING
COUNT
(
*
)
=
2
)
tmp
ON
t
.
order_code
=
tmp
.
order_code
AND
t
.
id
=
tmp
.
min_id
SET
t
.
sunshine_type
=
1
;
-- 再将另一条(id 较大的)设为 2
UPDATE
scrm_shopmall
.
shopmall_staff_motivation
t
JOIN
(
SELECT
order_code
,
MAX
(
id
)
AS
max_id
FROM
scrm_shopmall
.
shopmall_staff_motivation
WHERE
deleted_flag
=
'N'
AND
generate_type
=
0
AND
(
status
=
1
OR
(
status
=
2
AND
refund_type
=
1
))
GROUP
BY
order_code
HAVING
COUNT
(
*
)
=
2
)
tmp
ON
t
.
order_code
=
tmp
.
order_code
AND
t
.
id
=
tmp
.
max_id
SET
t
.
sunshine_type
=
2
;
\ No newline at end of file
\ No newline at end of file
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment