0

I have a table with CARD # and REDEEMED DATE. I am trying to figure out the total duration (in minutes) for each CARD #. I am using Microsoft SQL Server 2014

DATA

0
1

You just need to take the difference, in minutes, between the lowest date and the highest date, per card:

SELECT [CARD #], duration = DATEDIFF(MINUTE, 
  MIN([REDEEMED DATE]), MAX([REDEEMED DATE]))
FROM dbo.table_name 
GROUP BY [CARD #];
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.