I want the results to ignore the rows (as though they have already been deleted).
SELECT MAX(T1.id) AS MAXid
FROM transactions AS T1
WHERE id NOT IN ( 2 )
GROUP BY T1.position
ORDER BY T1.position
My guess is that I need to replace the "WHERE" line with "HAVING", but I cannot find "NOT HAVING" syntax.
The way this query is currently written, it will not return a row for T1.position if the max id for the position is listed in the WHERE clause.
How do I get this query to give me the max ID for the T1.position while overlooking the rows with IDs listed in the WHERE clause?
HAVING id NOT IN (2)
should work; [NOT] IN
isn't limited to WHERE
clauses.