Jump to content
We've recently updated our Privacy Statement, available here ×

Extraction of datas with query in Postrgesql database


hunt69

Recommended Posts

hi everybody !

I try to extract datas from a table A to a table B but I don't want that table B be the same that table A concerning the structure. SO I have a query which calculate value of severals fieldsthat I want to see in the table B. The 2 schemas of table A and B are the following :

table A : 2 fields : id et deb_sejour
table B : 7 fields : deb_sejour, year, quarter, month, week_of_year, week_of_month,day

My query is :

"SELECT deb_sejour,
    extract(YEAR from deb_sejour) as year,
    extract(QUARTER from deb_sejour) as quarter,
    extract(MONTH from deb_sejour) as month,
    extract(WEEK from deb_sejour) as week_of_year,
    (2 + extract(WEEK from deb_sejour) - extract(MONTH from deb_sejour) * 4) as week_of_month,
    extract(DAY from deb_sejour) as day
FROM datas_sejour"

I have the following error for each fields (except for deb_sejour which is commun to the both tables):

Exception in thread "main" java.lang.Error: Unresolved compilation problems:
    row1.year cannot be resolved or is not a field
    row1.quarter cannot be resolved or is not a field


I have a tpostgresqlinput objet and a tpostgresqloutput objet and my query appears in the query  parameter of the tpostgresqlimput object.

If someone has an idea, that will be great :)

Thanks a lot,

Regards,

Ted

Link to comment
Share on other sites

  • Replies 1
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...