Skip to content
Advertisement

How to format a Vertica date column into just the month?

I am trying to format a Vertica date column into only the month.

I would need the final value in some sort of date datatype so in the report I can order the results by date/time, not order by text. So that February sorts after January etc.

I am also tried:

The above statements produce an error “Invalid value for Month”

Any ideas?

Advertisement

Answer

How about this?

You can order by columns that are not in the select list.

EDIT:

If you want to combine months from multiple years, the above will not work quite right. This will:

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