In the sql server script within sql server 2005, I have the following lines;
CustomerName
,CustomerID
,convert(varchar,CustomerDateOfBirth,101)CustBirthDt
,convert(varchar,CustomerVisitDate,101)CustVisitDt
,datediff(dd,cust_birth_dt,getdate())/365.0 as CustAge
,datediff(dd,cust_birth_dt,visit_date)/365.0 as AgeAtVisit
Is it possible to modify the sql script to display the days elapsed since the last visit for each customer?
I would think that the data need to be ordered by CustomerName (ascending order) and then by CustomerVisitDate (ascending order).
CustomerName
,CustomerID
,convert(varchar,CustomerDateOfBirth,101)CustBirthDt
,convert(varchar,CustomerVisitDate,101)CustVisitDt
,datediff(dd,cust_birth_dt,getdate())/365.0 as CustAge
,datediff(dd,cust_birth_dt,visit_date)/365.0 as AgeAtVisit
Is it possible to modify the sql script to display the days elapsed since the last visit for each customer?
I would think that the data need to be ordered by CustomerName (ascending order) and then by CustomerVisitDate (ascending order).