Quantcast
Channel: Transact-SQL forum
Viewing all articles
Browse latest Browse all 23857

Get average days using datediff

$
0
0

hi guys,
   
   I have a requirements to sum up the qty and at the same time get the number of days at the same time get the aveerage days.

I have already the query but could not get the exact requirements.
here is the ddl and sample result..thanks in advance


create table #sample
(wrkctrid nvarchar(35),
 createddate datetime,
 lastupdate datetime,
 asustatus int)
 go
 insert into #sample
 select 'Assembly 2','2013-07-10','2013-07-19',5 union all
 select 'Assembly 2','2013-07-14','2013-07-23',5 union all
 select 'Assembly 2','2013-07-17','2013-07-23',1 union all
 select 'Assembly 2','2013-05-14','2013-05

Viewing all articles
Browse latest Browse all 23857

Trending Articles



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