Skip to content

Instantly share code, notes, and snippets.

@imvision
Created January 7, 2015 11:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save imvision/20584e2e9054c35a9721 to your computer and use it in GitHub Desktop.
Save imvision/20584e2e9054c35a9721 to your computer and use it in GitHub Desktop.
T-SQL Get duplicate entries
with x as (select *,rn = row_number()
over(PARTITION BY [VoucherID]
,[MTransRecord]
,[ControlID]
,[ClientID]
,[SetteldDate]
,[Debit]
,[Credit]
,[Amount]
,[Naration]
,[SelectionsName]
,[BFCommissionRate]
,[Post]
,[MarketID]
,[SelectionID]
,[BetID]
,[PlacedDate]
,[AvgOdds]
,[ComissionRate]
,[Stake]
,[Status]
,[BetType]
,[TransactionID]
,[BFTrans]
,[ExchangeNo]
,[EventID]
,[ExchangeID]
,[EventTypeID]
,[LCShare]
,[archive]
,[CurrencyBuyRate]
,[CurrencySaleRate]
,[IsComSharePosted]
,[IsSharePosted] order by ClientID)
from [BetProExch].[dbo].[Transactions])
SELECT * FROM x
where rn > 1 AND ClientID NOT IN (1, 4, 9)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment