思路话语

。Arlen:思想有多远你就能走多远...

更新/新增 SQL

update idc_position a,
(select positionid from equipment_position ) b   set a.status=2 where a.id=b.positionid

 

update equipment_position t1,
(select b.cicode,a.id from equipment_position a,t_device b where a.configitemid=2 and a.equipmentid=b.id) t2
set t1.cicode=t2.cicode where t1.id=t2.id

 

INSERT INTO business (Uid, ParentUid, LValue, RValue, Depth, TreeId, ChineseName, DepartmentId
, Description, ProductCode, ProductName, ProductDeptOaId, State, Id, Flag )
SELECT T1.CICode, '', 0, 0, T1.ServiceType, 0, T1.Name, T1.dep_id
, T1.Description, T1.ProductCode, T1.ProductName, T1.ProductDeptOaId, T1.State, T1.Id, 1
FROM s_service T1 LEFT JOIN s_x_sd T2 ON T2.ServiceIDRight = T1.Id AND T2.RelationType=1
WHERE  T1.ServiceType=1;

--注意字段一定要对应

posted on 2008-07-23 10:31  Arlen  阅读(390)  评论(0编辑  收藏  举报

导航