solomon_13000 14 Junior Poster in Training

I managed to duplicate a single record. However I intended to display the duplicate record with different values. For example:

A ABC 065 001 A10111 Sell 54.847500 0 0
T ABC 065 001 A10111 Sell 50.847500 0 1

SELECT 

case i.ordStatus 
when 'Queued' then 'N'
when 'Filled' then 'A'
when 'Partial Filled' then 'A'
when 'Cancel' then 'C'
end as 'ordStatus',

f.code as 'exchCode', 
g.code as 'companyCode', 
h.code as 'branchCode',
c.code as 'clientCode',
i.transType as 'transType',

case i.ordStatus 
when 'Queued' then ((i.quantity * i.price * i.exchRate) / j.denomination)
when 'Filled' then ((i.adjust * i.price * i.exchRate) / j.denomination)
when 'Partial Filled' then ((i.adjust * i.price * i.exchRate) / j.denomination)
when 'Cancel' then ((i.adjust * i.price * i.exchRate) / j.denomination)
end as 'ordAmount',

case i.ordStatus 
when 'Queued' then 0
when 'Filled' then 0
when 'Partial Filled' then 0
when 'Cancel' then 0
end as 'matchAmount'

from TM_TradingProfile a 
left join TM_clientTradingProfile b 
on a.id = b.id  
left join TM_Client c 
on c.id = b.TM_client_fk 
left join BKL_User d 
on d.id = c.id 
join BKL_Authentication e 
on c.id = e.BKL_user_fk 
left join RM_Exchange f
on a.RM_exchange_fk = f.id
left join BKL_Company g
on a.BKL_company_fk = g.id
left join BKL_Branch h
on a.BKL_branch_fk=h.id
left join RM_MarketTransaction i
on a.tradingAccountNumber = i.tradingAccNo
left join bkl_forexexch j
on i.tradCurr = j.currencyCodeFrom

CROSS JOIN (SELECT 1 UNION ALL SELECT 1) AS T(x)

where a.tradingAccountNumber='ST3273'

Besides, I should be able to display a duplicate record when the ordStatus is filled or partial filled.

Your help is kindly appreciated.

Thank You.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.20 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.