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/导出A8会员.sql

100 lines
3.0 KiB

1 year ago
use wuhan_yuyuan
SELECT * FROM TMemberTransHist
SELECT A.FId AS ID,
A.FMemId AS <EFBFBD><EFBFBD>ԱID,
CONVERT(VARCHAR,FTime,120) as ʱ<EFBFBD><EFBFBD> ,
CASE FBizType
WHEN 'Item' THEN '<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ŀ'
WHEN 'Goods' THEN '<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʒ'
WHEN 'CardSale' THEN '<EFBFBD><EFBFBD>ֵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'
WHEN 'CardRchg' THEN '<EFBFBD><EFBFBD>ֵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ'
WHEN 'CourseSale' THEN '<EFBFBD>Ƴ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'
WHEN 'Repay' THEN '<EFBFBD><EFBFBD><EFBFBD><EFBFBD>'
ELSE FBizType END AS ҵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,
FTransNo as <EFBFBD><EFBFBD><EFBFBD><EFBFBD>,
FContentText AS <EFBFBD><EFBFBD><EFBFBD><EFBFBD>,
wuhan_yuyuan.dbo.FNNumToStr(FQuantity) AS <EFBFBD><EFBFBD><EFBFBD><EFBFBD>,
wuhan_yuyuan.dbo.FNNumToStr(FAmount) AS <EFBFBD><EFBFBD><EFBFBD><EFBFBD>,
FPayment AS ֧<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʽ,
FEmployee AS Ա<EFBFBD><EFBFBD>
INTO TImpMemberTransHist
FROM wuhan_yuyuan..TMemberTransHist AS A
WHERE FMemId IN(SELECT FMemId FROM wuhan_yuyuan..TMember WHERE FDeleted = 0)
SELECT FMemId AS <EFBFBD><EFBFBD>ԱID,
FMemNO AS <EFBFBD><EFBFBD>Ա<EFBFBD><EFBFBD><EFBFBD><EFBFBD>,
FName AS <EFBFBD><EFBFBD><EFBFBD><EFBFBD>,FMobilePhone AS <EFBFBD>ֻ<EFBFBD>,
CONVERT(VARCHAR,FCreateDate,23) as <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ,
FBirthdayType AS <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,
ISNULL(CONVERT(VARCHAR,FBirthday,23),'') AS <EFBFBD><EFBFBD><EFBFBD><EFBFBD>,
dbo.FNNumToStr( FPoint) as <EFBFBD><EFBFBD><EFBFBD><EFBFBD>,FMemo AS <EFBFBD><EFBFBD>Ա<EFBFBD><EFBFBD>ע
INTO TImpMember
FROM TMember
WHERE FDeleted = 0
SELECT A.FCardId AS <EFBFBD><EFBFBD>ֵ<EFBFBD><EFBFBD>Id,A.FCardNo AS <EFBFBD><EFBFBD>ֵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>,T.FNo AS <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,T.FName AS <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,FMemId AS <EFBFBD><EFBFBD>ԱID,
CASE WHEN A.FState = 4 THEN 'ͣ<EFBFBD><EFBFBD>' WHEN A.FState = 32 THEN '<EFBFBD><EFBFBD>ʧ' ELSE '<EFBFBD><EFBFBD><EFBFBD><EFBFBD>' END AS ״̬,
CONVERT(VARCHAR,A.FCreateDate,23) as <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ,
CONVERT(VARCHAR,A.FExpiredDate,23) as <EFBFBD><EFBFBD>Ч<EFBFBD><EFBFBD><EFBFBD><EFBFBD> ,
FMemo AS <EFBFBD><EFBFBD><EFBFBD><EFBFBD>ע
INTO TImpMemberCard
FROM TMemberCard AS A,TMemberCardType AS T
WHERE A.FTypeId = T.FId
AND A.FDeleted = 0
SELECT A.FCardId AS <EFBFBD><EFBFBD>ֵ<EFBFBD><EFBFBD>Id,T.FName AS <EFBFBD>˻<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,dbo.FNNumToStr(A.FBalance) AS <EFBFBD><EFBFBD><EFBFBD><EFBFBD>, dbo.FNNumToStr(A.FArrear) AS Ƿ<EFBFBD><EFBFBD>
INTO TImpMemberCardAccount
FROM TMemberCardAccount AS A,TPayAccount AS T
WHERE A.FCardId IN(SELECT FCardId FROM TMemberCard WHERE FDeleted = 0)
AND T.FId = A.FAcctId
AND( A.FBalance > 0 OR A.FArrear > 0 )
SELECT * FROM TMemberCourse
SELECT A.FId AS ID,
A.FMemId AS <EFBFBD><EFBFBD>ԱID,
C.FName AS <EFBFBD>Ƴ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,
I.FName AS <EFBFBD><EFBFBD>Ŀ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>,
dbo.FNNumToStr(A.FPurTimes )AS <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,
dbo.FNNumToStr(A.FRemainPurTimes) AS ʣ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,
dbo.FNNumToStr(A.FFreeTimes) AS <EFBFBD><EFBFBD><EFBFBD>ʹ<EFBFBD><EFBFBD><EFBFBD>,
dbo.FNNumToStr(A.FRemainFreeTimes) AS ʣ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʹ<EFBFBD><EFBFBD><EFBFBD>,
dbo.FNNumToStr(A.FPurAmount) AS <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,
dbo.FNNumToStr(A.FRemainPurAmount) AS ʣ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,
dbo.FNNumToStr(A.FFreeAmount) <EFBFBD><EFBFBD><EFBFBD>ͽ<EFBFBD><EFBFBD><EFBFBD>,
dbo.FNNumToStr(A.FRemainFreeAmount) AS ʣ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͽ<EFBFBD><EFBFBD><EFBFBD>,
CONVERT(VARCHAR,A.FPurchaseDate,23) as <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ,
CONVERT(VARCHAR,A.FExpiredDate,23) as <EFBFBD><EFBFBD>Ч<EFBFBD><EFBFBD><EFBFBD><EFBFBD> ,
A.FMemo AS <EFBFBD><EFBFBD>ע
INTO TImpMemberCourse
FROM TMemberCourse AS A,TCourse AS C,TItem AS I
WHERE A.FItemId = I.FId
AND A.FCourseId = C.FId
AND A.FDeleted = 0
SELECT * FROM TMemberArrear
WHERE FRemainArrear > 0
use YuYuan
SELECT * INTO TImpMember FROM WuHan_YuYuan..TImpMember
SELECT * INTO TImpMemberCard FROM WuHan_YuYuan..TImpMemberCard
SELECT * INTO TImpMemberCardAccount FROM WuHan_YuYuan..TImpMemberCardAccount
SELECT * INTO TImpMemberTransHist FROM WuHan_YuYuan..TImpMemberTransHist
SELECT * INTO TImpMemberCourse FROM WuHan_YuYuan..TImpMemberCourse
create database YuYuan
SELECT * FROM TImpMemberCourse