Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ) as view1
- where currencyAbbr!=''
- and ForexAmount!=0
- and BS='B'
- order by currencyabbr) as firstbuy
- union all
- select * from
- (
- select distinct CONCAT(date(tr.dateandtime),' ',time(tr.dateandtime)) as transdatetime,
- CONCAT(date(tr.dateandtime),':',br.branchcode,':',tr.employeeid,':', tr.sequencenumber) as transactionnumber,
- tr.sequencenumber as SN, CONCAT(emp.employeeid,'-',emp.employeename) as TRL, br.BranchCode as BR,
- tr.TerminalID as TRM, fx.MidPointRate as WHRate, fx.PreviousDayMidPointRate as PRRate, CASE WHEN tr.currencycode=0
- then ' ' else currenc_abb(tr.currencycode) END as currencyabbr,
- CASE When tr.transactioncodeid in (2,3) then 'CASH'
- when tr.transactioncodeid=22005 then 'DRAFT'
- when tr.transactioncodeid=4 then 'ACCOUNT'
- when tr.transactioncodeid=22003 then 'WIRE' END as TYPE ,
- fx.operations as BS, CASE WHEN tr.forexamount=0 then ' '
- else FORMAT(tr.forexamount,2) END as ForexAmount, fx.ActualRate as TransRate,
- FORMAT(tr.amount,2) as Amount
- from `tbltransaction` tr
- Left JOIN `tblforextransaction` fx ON tr.dateandtime=fx.dateandtime
- INNER JOIN `tblbranch` br ON br.branchid=tr.branchid
- left join `tblemployee` emp on tr.employeeid=emp.employeeid
- where tr.branchid=11
- and date(tr.dateandtime)='2016-04-29'
- ) as view2
- where currencyAbbr!=''
- and ForexAmount!=0
- and BS='B'
- order by currencyabbr
- ) as blankline
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement