Tuesday, 15 September 2015

TSQL View, Exclude rows where one column value equals another -


I created a view for the daily total I need to exclude the rows to get more accurate data. I PaymentCode and In the designated view, CustomerID has two columns (among other), I need to exclude those lines where PaymentCode = Account and Customer ID = CASHLIG

& lt; & Gt; Which does not work because after that everything takes everything where PaymentCode = is the account that I do not want

Sample data

 | Payment code. CUSTOMERID | ---------------------------- | Cash | Cashless | | CCRD | Cashless | | Account | 10VICT003 | | Account | Cashless | | CCRD | Cashless | | Account | Cashless |  

Any suggestions? I tried to find an answer on this but it was not certain how this phrase is.

Your support will be greatly appreciated.

Renew

  See vw_DailyTotals as the Choose ... from ... where the payment code < & Gt; 'Account' or Customer ID & lt; & Gt; 'CashLeg'   

Sample output:

 | Payment code. CUSTOMERID | ---------------------------- | Cash | Cashless | | CCRD | Cashless | | Account | 10VICT003 | | CCRD | Cashless |  

This is a demo

No comments:

Post a Comment