Answer the question
In order to leave comments, you need to log in
How to convert a query to PostgreSQL?
Good day to all. I have a table with fields - (id, temp, hum, date). An entry is added to it every 5 minutes. There is a query that displays temp, hum and date for every hour for the current day. That is, 24 records.
SELECT temp, hum, date
FROM meteo_temp0
WHERE DATE(date) = CURDATE()
GROUP BY EXTRACT(HOUR FROM date)
ORDER BY EXTRACT(HOUR FROM date)
Help to convert it to PostgreSQL. I am attaching an image of the table for clarity. SELECT temp, hum, date
FROM meteo_temp0
WHERE DATE(date) = CURRENT_DATE
GROUP BY EXTRACT(HOUR FROM(date))
ORDER BY EXTRACT(HOUR FROM(date))
Gives an error message:column "meteo_temp0.temp" must appear in the GROUP BY clause or be used in an aggregate function
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question