|
|
|
|
use jinan_babi
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SELECT * FROM TImpMember
|
|
|
|
|
|
|
|
|
|
DROP TABLE TMember_Unique
|
|
|
|
|
|
|
|
|
|
SELECT MIN(FCreateDate) AS FCreateDate, FName,FMobilePhone,SUM(1) AS FCount,CAST(0 AS BIGINT) AS FNewMemId
|
|
|
|
|
INTO TMember_Unique
|
|
|
|
|
FROM TMember
|
|
|
|
|
WHERE FMobilePhone > ''
|
|
|
|
|
AND FMemId NOT IN(SELECT FMemId FROM TConsumeBill)
|
|
|
|
|
AND FMemId NOT IN(SELECT FMemId FROM TMemberSaleBill)
|
|
|
|
|
GROUP BY FName,FMobilePhone
|
|
|
|
|
HAVING(SUM(1) > 1)
|
|
|
|
|
|
|
|
|
|
--<EFBFBD><EFBFBD><EFBFBD><EFBFBD>memId
|
|
|
|
|
UPDATE A
|
|
|
|
|
SET A.FNewMemId = B.FMemId
|
|
|
|
|
FROM TMember_Unique AS A
|
|
|
|
|
INNER JOIN TMember AS B ON B.FMobilePhone = A.FMobilePhone AND A.FName = B.FName
|
|
|
|
|
WHERE B.FCreateDate = A.FCreateDate
|
|
|
|
|
AND B.FMemId NOT IN(SELECT FMemId FROM TConsumeBill)
|
|
|
|
|
AND B.FMemId NOT IN(SELECT FMemId FROM TMemberSaleBill)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
--<EFBFBD><EFBFBD>ȡ<EFBFBD>ﵽ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ļ<EFBFBD>Ա
|
|
|
|
|
SELECT A.FMemId,A.FMobilePhone,A.FName,B.FNewMemId
|
|
|
|
|
INTO TMember_Update
|
|
|
|
|
FROM TMember AS A,TMember_Unique AS B
|
|
|
|
|
WHERE B.FMobilePhone = A.FMobilePhone AND A.FName = B.FName
|
|
|
|
|
ORDER BY B.FMobilePhone
|
|
|
|
|
|
|
|
|
|
--<EFBFBD><EFBFBD>ʼ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
UPDATE A
|
|
|
|
|
SET A.FMemId = B.FNewMemId
|
|
|
|
|
FROM TMemberCard AS A,TMember_Update AS B
|
|
|
|
|
WHERE A.FMemId = B.FMemId
|
|
|
|
|
AND A.FMemId != B.FNewMemId
|
|
|
|
|
|
|
|
|
|
UPDATE A
|
|
|
|
|
SET A.FMemId = B.FNewMemId
|
|
|
|
|
FROM TMemberCourse AS A,TMember_Update AS B
|
|
|
|
|
WHERE A.FMemId = B.FMemId
|
|
|
|
|
AND A.FMemId != B.FNewMemId
|
|
|
|
|
|
|
|
|
|
UPDATE A
|
|
|
|
|
SET A.FMemId = B.FNewMemId
|
|
|
|
|
FROM TMemberCourseLog AS A,TMember_Update AS B
|
|
|
|
|
WHERE A.FMemId = B.FMemId
|
|
|
|
|
AND A.FMemId != B.FNewMemId
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SELECT * FROM TMember WHERE FName = '<EFBFBD><EFBFBD><EFBFBD><EFBFBD>'
|
|
|
|
|
|
|
|
|
|
SELECT * FROM TMemberCourse WHERE FMemId = 6376533
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
USE JINAN_BABI
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
UPDATE A
|
|
|
|
|
SET A.FMemId = B.FNewMemId
|
|
|
|
|
FROM TMemberCardAccount AS A,TMember_Update AS B
|
|
|
|
|
WHERE A.FMemId = B.FMemId
|
|
|
|
|
AND A.FMemId != B.FNewMemId
|
|
|
|
|
|
|
|
|
|
UPDATE A
|
|
|
|
|
SET A.FMemId = B.FNewMemId
|
|
|
|
|
FROM TMemberCardAcctHist AS A,TMember_Update AS B
|
|
|
|
|
WHERE A.FMemId = B.FMemId
|
|
|
|
|
AND A.FMemId != B.FNewMemId
|
|
|
|
|
|
|
|
|
|
UPDATE A
|
|
|
|
|
SET A.FMemId = B.FNewMemId
|
|
|
|
|
FROM TMemberTransHist AS A,TMember_Update AS B
|
|
|
|
|
WHERE A.FMemId = B.FMemId
|
|
|
|
|
AND A.FMemId != B.FNewMemId
|
|
|
|
|
|
|
|
|
|
UPDATE A
|
|
|
|
|
SET A.FMemNO = FMemNo + '<EFBFBD><EFBFBD>ͬɾ<EFBFBD><EFBFBD>',
|
|
|
|
|
A.FDeleted = 1
|
|
|
|
|
FROM TMember AS A,TMember_Update AS B
|
|
|
|
|
WHERE A.FMemId = B.FMemId
|
|
|
|
|
AND A.FMemId != B.FNewMemId
|
|
|
|
|
|
|
|
|
|
SELECT * FROM TMember_Update
|
|
|
|
|
|
|
|
|
|
SELECT * FROM TConsumeBill ORDER BY FBillTime DESC
|
|
|
|
|
|