AnsweredAssumed Answered

Writing SQL Results to a String

Question asked by derrickat on Feb 24, 2015
Latest reply on Mar 3, 2015 by derrickat

I have done this before, but of course have forgotten and can't find my code.

 

I want to take a result set from a query and write it to a string field.

 

So:

 

select

i.id prjId,

so.id soId

from

inv_investments i

JOIN odf_ca_my_subobject so on i.id = so.odf_parent_id

where

i.id < 5000005

(assuming 5 rows returned)

<core:forEach

<core:set

I want to put those IDs in a custom string field (my_string_field) on the project

sql:update

update odf_ca_project

set my_string_field = ${soId}

where id = ${prjId}

 

The problem is, the loop will overwrite the previous value each time. I want to cache the value and return all 5 results at once in the string field.

 

Thanks.

Outcomes