AVERAGE CALCULATION OF DAYS WITH TWO FIELDS DATE

1

Cordial greeting,

How can you calculate the average between dates in sql server and try the following:

SELECT SUM((DATEDIFF(DAY,HPNESTANC.HESFECING,HPNESTANC.HESFECSAL)))  
FROM HPNESTANC 
WHERE HPNESTANC.HPNDEFCAM IN (80,237, 238,239,240,241,242,243,244,
245,247,248,249,245,247,248,249,250,251,252,253,254,255,256,257,256,357) 
AND HPNESTANC.HESFECING BETWEEN '01-01-2018' AND  '31-01-2018' 

That throws me 147 days of stay, but then how would the average?

This query gives me 80 records, should I divide it among the 80 records? of the dates?

    
asked by Rafael 05.07.2018 в 23:30
source

0 answers