I can't seems to run two statements

Hi everyone! I am trying to combine the SELECT and UPDATE query but it’s not working. I want to use the SELECT query to retrieve the result and execute the UPDATE query using the retrieved values.

When I tried to save it, I got this pop-up error:

Unsupported query definition, StatementCount: 2, SetCount: 0

Is there any way around this?

Thanks in anticipation.

Hi Temitope,

I probably need a little more information to answer this fully but Five does support UPDATE SQL commands based on a SELECT.

For example if you are trying to achieve eeverything in one query you could execute:
LastAccessDate = (SELECT MAX(AccessDate) FROM LogFile WHERE LogFile.UserKey = User.UserKey);

If you are using queries inside logic it would require a five.executeQuery() command for the SELECT statement and then a loop going through the results executing another five.executeQuery() with the UPDATE statement for each record you wanted to update.

Hope this helps but let me know if you need more information.


1 Like

I switched to running the query inside the logic using the five.executeQuery() and it’s working fine now. Thanks.