How would I do this in SQL?
- by bergyman
Let's say I have the following tables:
PartyRelationship
EffectiveDatedAttributes
PartyRelationship contains a varchar column called class.
EffectiveDatedAttributes contains a foreign key to PartyRelationship called ProductAuthorization.
If I run this:
select unique
eda.productauthorization
from
effectivedatedattributes eda
inner join
partyrelationship pr
on
eda.productauthorization = pr.ID
where
pr.class = 'com.pmc.model.bind.ProductAuthorization'
it returns a list of ProductAuthorization IDs. I need to take this list of IDs and insert a new row into EffectiveDatedAttributes for every ID, containing the ID as well as some other data. How would I iterate over the returned IDs from the previous select statement in order to do this?