```
USE [UAT]
GO

/****** Object:  View [dbo].[vwVOUCHER_EXPORT]    Script Date: 2/6/2019 1:35:42 PM ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

ALTER VIEW [dbo].[vwVOUCHER_EXPORT] AS
SELECT [VOUCHER].[ID] 
      ,[VOUCHER].[EMP_ID] 
      ,[VOUCHER].[DATE_TO_PAY]
      ,[VOUCHER_PAYMENT].[PAYEE_NAME]
      ,[VOUCHER_PAYMENT].[BANK_ACCOUNT_ID] 
      ,[VOUCHER_PAYMENT].[VENDOR_ADDRESS_ID]    
      ,[VOUCHER].[PAYMENT_METHOD]   

FROM VOUCHER            
    INNER JOIN VOUCHER_STATUS ON VOUCHER.VOUCHER_STATUS_ID = VOUCHER_STATUS.ID
    LEFT OUTER JOIN VOUCHER_PAYMENT ON VOUCHER.ID = VOUCHER_PAYMENT.VOUCHER_ID
    LEFT OUTER JOIN BANK_ACCOUNT ON VOUCHER.EMP_ID = BANK_ACCOUNT.EMP_ID
    LEFT OUTER JOIN VENDOR ON VOUCHER.PAYEE_VENDOR_ID = VENDOR.ID

GO

```

I am using MS SQL Server 13. With this view I am returning payment details. Each EMP\_ID can have multiple bank\_account\_ids, and vendor\_address\_ids. The payment method types are EQPMWT, EQPMMC, and EQPMAH. In the attached screen schot, you can see that they could have two bank account ids, and or, two vendor\_address\_ids. I need to append a number to the PAYMENT\_METHOD field value EQPMWT, EQPMMC, and EQPMAH base on the numeric value of the bank\_account\_id and the vendor\_address\_id asc

Attached is a screen of what this query returns and as well as what I need. [![what I have](https://i.stack.imgur.com/p4rs0.png)](https://i.stack.imgur.com/p4rs0.png)

[![what I need](https://i.stack.imgur.com/ESpmW.png)](https://i.stack.imgur.com/ESpmW.png)

This view is being used to generate XML for another system. I don't want to change the value of this field in the db, only in this view. 

I hope this is a little more clear. Thank you.