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/Import/金典NOS/SQLQuery32.sql

49 lines
1.2 KiB

1 year ago
USE NOS_MJDZX
drop table #member
SELECT gca01c,gak02c,gba03c,gba08c,gsb03c,gcc06f,gae03c
into #member
FROM gcm01 AS A
left join gam10 on gak00c = gca00c and gak01c = gca02c
left join gbm01 on gba00c = gca00c and gba01c = gca04c
left join gcm03 on gcc00c = gca00c and gca01c = gcc01c and (gcc03i = 2 or isnull(gcc06f,0) != 0)
left join gsm02 on gsb00c = gca00c and gsb01c = 'O' and gsb02c = gcc03i
left join gam05 on gae01c = gca00c
where a.gca00c = a.gca13d
and substring(a.gca01c,1,2)<>'ɢ<EFBFBD><EFBFBD>'
and (a.gca08i=4 or a.gca08i=5 or a.gca08i=10)
SELECT gca01c as <EFBFBD><EFBFBD><EFBFBD><EFBFBD>,gak02c <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,gba03c <EFBFBD><EFBFBD><EFBFBD><EFBFBD>,isnull(gba08c,'') <EFBFBD>ֻ<EFBFBD>,gsb03c <EFBFBD>˻<EFBFBD>,gcc06f <EFBFBD><EFBFBD><EFBFBD><EFBFBD>,gae03c <EFBFBD><EFBFBD>˾
from #member
where gsb03c != '<EFBFBD>Ƴ<EFBFBD><EFBFBD>˻<EFBFBD>'
and gsb03c is not null
UPDATE #member SET gba08c = '' where gba08c = 'NULL'
SELECT gsb03c,sum(1)
from #member
group by gsb03c
sp_helptext upg_analyzer_customer_order_regdate
exec upg_analyzer_customer_order_regdate
@class = '*',
@compid = '002',
@frommemid = '*',
@tomemid = '*',
@fromdate = '*',
@todate = '*',
@state = '*',
@acon_amt = 0,
@alastdate = '*',
@at_times = 0,
@aav_amt = 0,
@aless_remain = 0,
@abig_remain = 0,
@addtoSMS = 0,
@ordertype = 0,
@only_card_pay = 0,
@memfromdate = '*',
@memtodate = ''