Sql query | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Sql query

Can someone help me with arranging a query for SQL? I need to count average time for a day? Thanks.

6th Jun 2022, 9:20 AM
Daniel Gheorghita
Daniel Gheorghita - avatar
3 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
6th Jun 2022, 10:36 PM
Brian
Brian - avatar
0
This is a question better suited for Google since you're not even specifying which SQL language.
6th Jun 2022, 9:38 AM
Justice
Justice - avatar
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.
6th Jun 2022, 9:43 AM
Daniel Gheorghita
Daniel Gheorghita - avatar