One Star

SQL + date filter

I a new taled user.
i have this question: how to filter data from a table by a date.
My project read an oracle table and have to write a oracle table.
table1 ( source )
id ( number), surname (string), name ( string), birthday( date)
table2 (destination )
id ( number), surname (string), name ( string)
i have to ransfer all the record where the birthday is > .
I'm able to read the record and write them in the table, but i'm not able ti filter by the date.
someone can help me ?


Seventeen Stars

Re: SQL + date filter

You have successfully created an input component. Take al look at the query. You can edit the query and introduce changes. Assuming you have a context variable containing a date which should be used as filter.
Here an example which assumes you have a context variable containing a date called last_modified
from customers
where birthday > ('" + TalendDate.formatDate("yyyy-MM-dd", context.last_modified) +"' - 6 month)"

Yes it is a bit cumbersome but until Talend enables prepared statement parameters for normal input components we have to tweak the SQL it self.