Creating a Custom Table update/select

I have a table with data from multiple machines, and want to update the last row of the table for a particular machine with a group. I tried creating an sql tag called “A055_Down_Last_ndx” with the following expression:
SELECT max(ndx)from Machine_Data where (Machine_Name)=‘A055’
The idea was to find the last index for that machine, however I get an error for this tag and a null value.
Then I was planning on using the custom option in the table update/select, and entering the following in the field:
(ndx)={A055_Down_Last_ndx}

Any suggestions on better methods would be appreciated.
Thanks.

Why don’t you use transaction groups? Updating the last row of the table is a built-in feature of the Standard Group…

Your method will work - your error was probably just a syntax error. Also -you said you used that query as an expression. Did you have the tag correctly set to SQL Query mode instead of expression mode?

I needed to use a custom table update/select because there are several machines logging to the same table during this transaction, so I need to find the last transaction for the particular machine that the group is tied to.
The problem ended up being that I did not have the Realtime SQLTags Providers pointed to my database.

You could probably do this all directly in the group’s Where clause, no tag required:
Update Custom Where

ndx = (SELECT max(ndx) from Machine_Data where (Machine_Name)='A055')