You are viewing this site as a guest. You can still ask questions and help others! Join our Dev2Dev IT Community to receive your own blog, share your knowledge, and much more.

How to insert values into table based on condition from another table

1 reply [Last post]
Guest's picture
Guest

Hi,

Can anyone help me in inserting a value into table based on values from another table.

for Example
____________________________________________________________

i want to insert value "a" if value a particular value in the other table is "c" and i want to insert value "b" if value in the others table is "d"

i hope i am not making it too complex

Thanks in advance!!!

Hari_aindian's picture
User offline. Last seen 5 years 18 weeks ago. Offline
Joined: 08/02/2010
Posts: 84
Re: How to insert values into table based on condition from ...

Where you are going to place this code piece to insert the value?

Are you going to use this in App Engine ? Are you expecting a sql to do this? or Are you going to work in Peoplecode?

If Peoplecode do the following things.

1) create 2 row sets for each records

2) now loop through the rowset(you are going to check value of this table to assign it to target table)

3) Use case statements if you have many values to be assigned to target table based on this table else you can use If else statements to assign the values.