Finding average of difference in two different dates

Hi All,

I am trying to find the average difference in the dates between two different dates at a level of plant ,segment, model and part..I used the Group by tile for the same and in the aggregated column I am writing the below formula

AVG(DATEDIFF(`cur_prm_date`,`prmdate7` )) over (order by `cur_prm_date`) for which I am getting an error..


Syntax error in expression at character 42 on line 1:AVG(DATEDIFF(`cur_prm_date`,`prmdate7` )) over (order by `cur_prm_date`)



Thanks,

Arun

Tagged:

Comments

  • Since you're doing a windowing function have you looked into the Rank & Window tile?

    **Was this post helpful? Click Agree or Like below**
    **Did this solve your problem? Accept it as a solution!**
  • Hi @GrantSmith , I used redshift sql finally..I have to get used to the rank and window tile..