Sidebar

What is the syntax for the Database Update SQL Stmnt to reference the query results?

0 votes
455 views
asked Apr 14, 2020 by brandon-w-8204 (33,270 points)

I need to update records as processed. I am using a DB Query source node. What is the syntax to reference values from the query results?

 

1 Answer

0 votes

You can reference the values from the results using the following syntax

By fieldName:    {fieldName}  - This will get you the value in that field by name.
By number:   {1} - This will get you the value in the first column.  

Example: update table set processed = true where id = {id}

The other option to ensure you update is the "Execute the following SQL update statement once per". The options are as follows:

Record Group: This is based on what you have set on the "# of rows to include in each group" under Record Grouping. 
Result Set: This will only run the statement once when the db is queried. But not by individual row.
Row: This will execute the update statement for each row regardless of other settings.

answered Apr 14, 2020 by brandon-w-8204 (33,270 points)
...