insert into fin_subject_count (UID,subject_id,subject_count_type,balance,object_id,state,gmt_create,gmt_modified)
select
(SELECT count(*) as dd FROM bas_business_unit as a where a.unit_uid<b.unit_uid)+1000 as newUid
,
(SELECT count(*) as dd FROM bas_business_unit as a where a.unit_uid<b.unit_uid)+1000 as subject_id
,1,0,b.unit_uid,1,now(),now() from bas_business_unit as b
select
(SELECT count(*) as dd FROM bas_business_unit as a where a.unit_uid<b.unit_uid)+1000 as newUid
,
(SELECT count(*) as dd FROM bas_business_unit as a where a.unit_uid<b.unit_uid)+1000 as subject_id
,1,0,b.unit_uid,1,now(),now() from bas_business_unit as b
SQL插入业务单元数据
本文介绍了一种使用SQL语句来实现业务单元数据的插入方法。通过计算新的UID和subject_id,确保数据能够正确地被添加到fin_subject_count表中。此过程涉及到了对现有业务单元表的查询来确定新记录的位置。
1886

被折叠的 条评论
为什么被折叠?



