0
Sql query
Can someone help me with arranging a query for SQL? I need to count average time for a day? Thanks.
4 Answers
+ 1
Daniel Gheorghita did you misspell the DATEDIFF() function?
Missing comma after Date_Time.
To get the average time, use the aggregate average function
AVG(DATEDIFF(.....)) averagetime
0
This is a question better suited for Google since you're not even specifying which SQL language.
0
Transact sql,
Task to find an average time for all orders in the specific day:
So:
SELECT
Date_Time
Daferiff(hour, creation_date_time, ship_date_time) averagetime
From shipments
Where company = âabcâ
And creation_date_time = â2022-05-23â and ship_date_time is not null.