using informix db 11.50.FC3
AIX Unix server 6.1 O/S
I have two tables. I want to get values out of one table and update the other table.
Table 1.
first_name
last_name
family_id
Table 2.
first_name
last_name
f_id
create_date
ref_no
I want to update the first_name and last_name columns in Table 1 with the first_name and last_name columns in Table 2, while doing an inner join on family_id and f_id. Only update if first_name and last_name are both null in Table 1 AND if the create date is greater than 1/1/13. Seems fairly straight forward right?
SQL
update table1 a
set a.first_name =
(select b.first_name
from table2 b
where b.f_id = a.family_id
and b.create_date > '01/01/13'
and a.first_name is null
and a.last_name is null
and b.ref_no between 1 and 10
)
set a.last_name =
(select b.last_name
from table2 b
where b.f_id = a.family_id
and b.create_date > '01/01/13'
and a.first_name is null
and a.last_name is null
and b.ref_no between 1 and 10
)
I get an error: 37000(-201), which seems like a generic error message code i get for almost anything.
AIX Unix server 6.1 O/S
I have two tables. I want to get values out of one table and update the other table.
Table 1.
first_name
last_name
family_id
Table 2.
first_name
last_name
f_id
create_date
ref_no
I want to update the first_name and last_name columns in Table 1 with the first_name and last_name columns in Table 2, while doing an inner join on family_id and f_id. Only update if first_name and last_name are both null in Table 1 AND if the create date is greater than 1/1/13. Seems fairly straight forward right?
SQL
update table1 a
set a.first_name =
(select b.first_name
from table2 b
where b.f_id = a.family_id
and b.create_date > '01/01/13'
and a.first_name is null
and a.last_name is null
and b.ref_no between 1 and 10
)
set a.last_name =
(select b.last_name
from table2 b
where b.f_id = a.family_id
and b.create_date > '01/01/13'
and a.first_name is null
and a.last_name is null
and b.ref_no between 1 and 10
)
I get an error: 37000(-201), which seems like a generic error message code i get for almost anything.