Ich ändere meine Datenbank (SQL Server) zu Postgres aber die Abfrage, die ich gewohnt bin, funktioniert nicht in Postgres. Join funktioniert nichtJoin Tabelle funktioniert nicht in Postgres
SELECT DISTINCT CONCAT(TOTALIZER_METER_READINGS.date,' ',TOTALIZER_METER_READINGS.time)
FROM TOTALIZER_METER_READINGS
JOIN (
SELECT CONCAT(date,' ',MIN(time))::timestamp as mints FROM TOTALIZER_METER_READINGS
WHERE date = '2017-08-20'
GROUP BY date, date_part('hour', time)
)tt
ON TOTALIZER_METER_READINGS.time = tt.mints AND TOTALIZER_METER_READINGS.date = tt.mints
ORDER BY 1 ASC
Der Fehler ist:
ERROR: operator does not exist: time without time zone = timestamp without time zone LINE 8: ON TOTALIZER_METER_READINGS.time = tt.mints AND TOTALIZE... ********** Error **********
Wie kann ich dieses Problem beheben?
Welches Ergebnis erwarten Sie, wenn Sie ein 'Time' Vergleich zu einem 'Zeitstempel'? Sie müssen entweder Ihre Spalte "time" auf einen "timestamp" (aber welches Datum?) Oder Ihren "timestamp" auf einen Wert "time" umstellen. –
Ich habe bereits den Datentyp von Zeit zu Zeitstempel geändert und der Fehler ist immer noch der gleiche –