Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How to load data from a specific year.

I'm stuck on a seemingly easy task. I load data from a table with a date column and want to filter the data to only load records from a specific year.

I've been trying alot of different variants as candidates for the WHERE clause, all with different errors.

start_time is the name of the column that hold the date.

LOAD ....

SQL SELECT

...

FROM "fact_table"

WHERE Year('2014-01-01')=Year(Date(start_time));

SQL##f - SqlState: 42883, ErrorCode: 7, ErrorMsg: ERROR: function year(unknown) does not exist;

let start_date=MakeDate(2014, 01, 01);

...

WHERE Year($(start_date))=Year(start_time);

ErrorCode: 7, ErrorMsg: ERROR: function year(integer) does not exist;


What am I doing wrong here?

1 Solution

Accepted Solutions
Gysbert_Wassenaar

Your database server doesn't understand qlikview functions like Year. If you use Postgresql then you can try the Extract function.


talk is cheap, supply exceeds demand

View solution in original post

3 Replies
Gysbert_Wassenaar

Your database server doesn't understand qlikview functions like Year. If you use Postgresql then you can try the Extract function.


talk is cheap, supply exceeds demand
Not applicable
Author

That makes sense.

I'm using postgresql and the following did the trick.

WHERE start_time >= '2014-01-01' AND start_time < '2015-01-01';

Thanks!

mohamed_ahid
Partner - Specialist
Partner - Specialist

have you tried to execute directly the sql request on the database ?