I am using control center HFSQL of windev 20 to execute a query. I would like to calculate the time and date difference, between the maximum and the minimum MAX (hour) and MIN (hour) for each service and also the number of days if there is.
I tried the functions DateDifference and DateTimeDifference but unfortunately I have an error.
the following code is just to see the maximum and the minimum hour for each service it works perfectly but not what i want :
SELECT Service.Libellé AS Libellé,
Min(DetailCircuitFacture.Heure),MAX(DetailCircuitFacture.Heure)
FROM detailcircuitfacture
joIN Service on
Service.CodeSce=detailcircuitfacture.CodeSce
group by Service.Libellé
i want to make difference of date and hour between MAX and Min for each service like so :
SELECT Service.Libellé AS Libellé, WL.DateDifférence(Min(DetailCircuitFacture.DATE),
Max(DetailCircuitFacture.DATE)) AS Nombre_jours,
WL.DateHeureDifférence(Min(DetailCircuitFacture.Heure),Max(DetailCircuitFacture.Heure)) AS Nombre_heurs
FROM detailcircuitfacture
JOIN Service on
Service.CodeSce=detailcircuitfacture.CodeSce
group by Service.Libellé
I expect the output without error, but the actual output is
Error in the SQL code of the <> request. Initialization of the query impossible. Aggregate functions (COUNT, AVG, SUM, MIN, MAX) are not allowed outside SELECT or HAVING clauses
expect result
Thanks by advance