I have been trying to get through with the following query:
UPDATE transactions
SET proposal= MAX(proposal) + 1
WHERE id =1054
But it shows error. Can anyone help me?
I have been trying to get through with the following query:
UPDATE transactions
SET proposal= MAX(proposal) + 1
WHERE id =1054
But it shows error. Can anyone help me?
You probably need a sub-query based on your criteria which is unclear at this point. MAX() is typically based on an aggregate and not what you have. Without knowing more, your query probably needs to be something like...
UPDATE transactions
SET proposal = 1 + ( select MAX(proposal) from transactions where SomeCondition )
WHERE id = 1054
So the inner select MAX() is getting a proposal amount from the transaction table, but I don't know what your criteria is that you need. If the transaction table has many records with id = 1054, then your inner "SomeCondition" would also be... "id = 1054".
if you are trying to compare to another transaction and want the highest, then adjust as needed.