I have a SQL query that gives average time to signup for our users who signed up in the last 30 days Is:
Select Average (dated (DD, Acquisition, Manufactured)) where users create & gt; Getdate () - 30 and acquisitionmedium = 'cpc' and acquisitionsource = 'google' and are not zero at the time of acquisition I want to see how it has changed over time.
How can I change this question so that I can spit a month (month, average time to sign up for that month)?
select DATEADD (month, -n.number, getdate ()) OneMonthFromThisDate, Avg (datediff (dd, acquisitiontime, create)) AverageInThisMonth user from master.Spept_values N on n type = 'P' and N. Between Numbers 1 and 24 & gt; DATEADD (month, -n.number, getdate ()) and created & lt; = DATEADD (month, 1-n number, getdate ()) and acquisitionmedium = 'cpc' and acquisitionsource = 'google' and the acquisition is not zero group by N.number, DATEADD (month, -n.number, getdate () ) Order by n.number This puts the first most recent.
Comments
Post a Comment