mardi 21 juin 2016

Join & Subquery to calculate Minimum datediff

I have 2 SQL tables, one for subscribers (ID, Name), second for subscribers_Upgrades [Subscriber_ID (FK), Upgrade_Level, Upgrade_Date)

(There are 7 upgrade levels)

I need a query to get the top 10 subscribers who upgraded in the shortest period and Upgrade_Level, and Upgrade Date for specific Upgrade_Level (any one of the available 7 Upgrade level), and within specific period of time

We can, for example supply the 2 conditions like
Where Upgrade_Level = 3 and Upgrade_Date between '01-April-2014' and '20-May-2016'

Aucun commentaire:

Enregistrer un commentaire