Not sure if this is the right place.
I have a slight problem. Any SQL genius's out there that can help with the below.
I need to write a query where I need to count the distinct number of payment options used in 30 minutes per account. Now I was thinking the below..but it doesnt work cause it takes all the the transactions into account for the entire account rather than just going back 30 minutes per transaction...confused yet?
SELECT
Accountnumber,
COUNT(DISTINCT(CASE WHEN TransactionDate >= DATEADD(minute,-30,TransactionDate) AND TransactionDate <= TransactionDate THEN PaymentOp END))
I have a slight problem. Any SQL genius's out there that can help with the below.
I need to write a query where I need to count the distinct number of payment options used in 30 minutes per account. Now I was thinking the below..but it doesnt work cause it takes all the the transactions into account for the entire account rather than just going back 30 minutes per transaction...confused yet?
SELECT
Accountnumber,
COUNT(DISTINCT(CASE WHEN TransactionDate >= DATEADD(minute,-30,TransactionDate) AND TransactionDate <= TransactionDate THEN PaymentOp END))
Last edited: