Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- select src, count(*) from mx0
- where src like '%ac8258%'
- group by src
- select * from mx0 where amt1=14658593
- select * from mx0 where amt1 != amt2
- ---- cek str sbg ----
- -- bikin temp table --
- drop table #mx
- select date,acct2 acct,amt2/1000 amount into #mx
- from mx0 where src like '%ac8258_201801'
- and acct2='ac8258'
- select * from #mx
- -- cek match join --
- select s.*, b.date,b.payee from
- (select * from sbg.rk where acno like '%8258') b join
- (select * from #mx) s on b.amount=s.amount
- -- self-all = left join --
- select s.*, b.date,b.payee from
- (select * from #mx) s left join
- (select * from sbg.rk where acno like '%8258' and ctg is null) b
- on s.amount=b.amount
- -- update RK if match with mx --
- update sbg.rk set cmd=501, ctg='str',xctg='tunai',ref=s.date
- from sbg.rk join
- (select * from sbg.rk where acno like '%8258' and ctg is null) b
- on rk.id=b.id join (select * from #mx) s
- on round(b.amount,0,1)=round(s.amount,0,1)
- and datediff(dd,s.date,b.date)<7
- -- cek self not bank --
- select s.*, b.date,b.payee from
- (select * from #mx) s left join
- (select * from sbg.rk where acno like '%8258') b
- on s.amount=b.amount and s.date=b.ref
- order by s.date
- select * from sbg.rk where acno like '%8258'
- and date between '20180101' and '20180201'
- and amount > 0 and ctg is null
- select * from sbg.rk where acno like '%8258'
- and year(date)=2018 and month(date)=1
- select type, sum(amount), count(*) from rkbca where acno like '%8258'
- and year(date)=2018 and month(date)=1
- group by type
- select cmd, count(*) from sbg.rk
- where acno like '%8258'
- and ctg='str'
- group by cmd
- update sbg.rk set ctg=null, xctg=null, cmd=null
- where cmd in (110,113,121)
- select s.amount-b.amount, s.*, b.date,b.payee, datediff(dd,s.date,b.date) from
- (select * from sbg.rk where acno like '%8258' and ctg is null) b join
- (select * from #mx) s on round(b.amount,0,1)=round(s.amount,0,1)
- and datediff(dd,s.date,b.date)<7
- select round(123.567,0,1)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement