I need to create a SQL Select that will pull all the fields as per the code below and have an additional field based on the field Pay or Receive.
If field is Pay new field says 'Pay by Position'
If field says receive, new field says pay by customer
can you please help
select p.PORTFOLIOMNEMONIC, td.TRADEDIRECTION, cf.CUSTOMERID, cf.CUSTOMERMNEMONIC, TP.TRADECCY1AMOUNT
from CUSTOMERFAMILY cf
left join CUSTOMER c on c.CUSTOMERID = cf.CUSTOMERID
left join PORTFOLIO p on p.VERIFICATIONCODE = c.VERIFICATIONCODE
left join TRADEDETAIL td on td.CUSTOMERID = c.CUSTOMERID
left join TRADEPOSITION tp on td.TRADEDIRECTION = tp.TRADEDIRECTION
--p.PORTFOLIOMNEMONIC in( 'MAIN') and
cf.CUSTOMERID like '%IFE%' and
td.tradedirection in( 'PAY', 'RECEIVE')