Quantcast
Viewing all articles
Browse latest Browse all 4871

SQL - Sum field based on two earliest dates

Hello,

Is there a generic way to sum up a field based on the two earliest dates?

"Table" consists of the following columns:

1) Date

2) VisitorID

3) Revenue

Basically, for each unique Visitor ID, I want to provide the sum of Revenue for the two earliest dates in the table.

Is there a quick way to calculate this? Most online solutions only look at the earliest date, and not the two earliest.

Thank you in advance!


Viewing all articles
Browse latest Browse all 4871

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>