Files
zkxw/docs/sql/qc_material_usage_out_fields_backfill.sql
T
2026-05-21 03:48:06 +08:00

26 lines
581 B
SQL
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
-- 回填手动出库记录的领用人、用途(从 remark 解析,可重复执行)
SET NAMES utf8mb4;
UPDATE `biz_qc_material_usage`
SET
`receiver` = TRIM(
SUBSTRING_INDEX(
SUBSTRING_INDEX(`remark`, '领用人:', -1),
';',
1
)
),
`purpose` = TRIM(
SUBSTRING_INDEX(
SUBSTRING_INDEX(`remark`, '用途:', -1),
';',
1
)
)
WHERE `source_type` = 'manual_out'
AND `del_flag` = 0
AND `remark` LIKE '%领用人:%'
AND (
`receiver` IS NULL OR `receiver` = '' OR `purpose` IS NULL OR `purpose` = ''
);