Skip to content
Advertisement

Hourly average for timestamps columns – FROM keyword not found where expected

I would like to get the hourly average of two columns. The type of the columns is timestamp.

I try this:

I do not know if this is the right way to go at all. But the query is not correct. I get this error: 00923. 00000 - "FROM keyword not found where expected"

In the end I would like to get a table like this one:

How can I get this?

Advertisement

Answer

You need to include all the columns you are going to use in the outer-query in the SELECT clause of the inner-query and you cannot use an alias of the SELECT clause in the GROUP BY clause in the same sub-query:


If you do not have (or are not worried about) fractional seconds then you could also use:

db<>fiddle here

User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement