You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
sql-tools/检查单据上的部门.txt

34 lines
1.1 KiB

SELECT * FROM TConsumeItem WHERE FDeptId NOT IN(SELECT FId FROM TBasicType) OR FDeptId = 0
SELECT * FROM TConsumeGoods WHERE FDeptId NOT IN(SELECT FId FROM TBasicType)OR FDeptId = 0
SELECT * FROM TMemberSaleCourse WHERE FDeptId NOT IN(SELECT FId FROM TBasicType)OR FDeptId = 0
SELECT * FROM TMemberSaleCard WHERE FDeptId NOT IN(SELECT FId FROM TBasicType)OR FDeptId = 0
SELECT * FROM TMemberSaleCoursePack WHERE FDeptId NOT IN(SELECT FId FROM TBasicType)OR FDeptId = 0
SELECT * FROM TConsumeItem WHERE
SELECT * FROM TEmployee WHERE FDeptId NOT IN (SELECT FId FROM TBasicType)
SELECT * FROM TItem WHERE FDeptId NOT IN (SELECT FId FROM TBasicType)
SELECT * FROM TGoods WHERE FDeptId NOT IN (SELECT FId FROM TBasicType)
UPDATE B
SET B.FDeptId = A.FDeptId
FROM TConsumeItem AS B,TItem AS A
WHERE A.FId = B.FItemId
UPDATE B
SET B.FDeptId = A.FDeptId
FROM TMemberSaleCourse AS B,TItem AS A
WHERE A.FId = B.FItemId
UPDATE B
SET B.FDeptId = A.FDeptId
FROM TMemberSaleCard AS B,TMemberCardType AS A
WHERE A.FId = B.FCardTypeId
UPDATE B
SET B.FDeptId = A.FDeptId
FROM TConsumeGoods AS B,TGoods AS A
WHERE A.FId = B.FGoodsId