How can I filter my data down to a given Year or Month in a PSQL v13 Database

52 Views Asked by At

I get a syntax error in PSQL Control Center on an Actian 13 database when using Date_Part and I'm out of ideas on how to proceed.

There are two fields in the table I am querying 'Date' and 'CreateDate'. I get the same error when I involve either field. I have tried both 'month' and 'year' and have confirmed the field in the database is a Date field.

I have tried the following with no luck.

select date_part('month',CreateDate) from gl_trx3 where CreateDate = '2021-10-13'

I am using this specific date for example because there are records with that date saved.

The error message I get is below.

[LNA][PSQL][SQL Engine]Error in expression: date_part('month',CreateDate)

Anyone know what I am missing?

1

There are 1 best solutions below

0
On

In the list of Time and Date Functions for Pervasive SQL13 the function date_part does not exist.

Using MONTH(dateexp) returns the month as an integer in the range of 1 to 12.