Skip to content
Advertisement

SQL Server – Generate a column value which satisfy same condition in a day

I have a transaction table (Tran_Table) that contains Account Number, Transaction Date, Transaction Amount. I would like to generate a column that has “Yes” or “No” info in case if a transaction repeated in same day with same amount for same customer. Table and generated value example are shown below.

how can i do this?

Advertisement

Answer

You can use window functions and a conditional expression:

User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement