Extraction of datas with query in Postrgesql database

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

hunt69's picture
54
Joined: Jun 19 2008 - 1:20am
Last seen: 15 years 3 months ago

1 Answer:

 As an attachment can you post your schema?

That would help understand what you are doing..

 

Ries

riesvantwisk's picture
Joined: Feb 21 2008 - 8:09am
Last seen: 6 years 9 months ago
Feedback
randomness