9

I am trying to select the date_trunc value:

select date_trunc(HOUR, current_date - interval '1' hour);

OR

select date_trunc(HOUR, current_date);

And got error:

[42703] ERROR: column "hour" does not exist Позиция: 19
Cherry
  • 31,309
  • 66
  • 224
  • 364

1 Answers1

12

Your question borders on just being a typo, but from what I could find the date/time unit first parameter to date_trunc needs to be in single quotes:

select date_trunc('HOUR', current_date - interval '1' hour);
OR
select date_trunc('HOUR', current_date);

This answer might be worth posting as Presto's own documentation does not give any actual examples of how to use date_trunc.

Tim Biegeleisen
  • 502,043
  • 27
  • 286
  • 360