Click here to Skip to main content
15,891,136 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

I have written an update query in AS400.

SQL
update s1 set age=(select b.age from s1 a, s2 b where a.id = b.id)
where name in (select b.name from s1 a, s2 b where a.name = b.name)


This query is to update age in the table 'S1', when ID and name matches with the table S2.

But it's showing Data conversion or data mapping error

Please help
Posted
Updated 27-May-13 9:22am
v2
Comments
Are you sure the below condition is correct ?

where a.id = b.name

Please post some rows of each table for example.
srmohanr 27-May-13 15:22pm    
Sorry, its a.id = b.id

1 solution

It is possible that the query
SQL
(select b.age from s1 a, s2 b where a.id = b.name)

is returning multiple rows hence you can't set them to a single value in age.
 
Share this answer
 
Comments
srmohanr 27-May-13 15:33pm    
Hello,

I have posted the wrong query. Its not a.id = b.name, but a.id=b.id.....

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900