I want to assign a value to a user defined variable based on a comparison of that variable and a field within a row. (MySQL)
Example:
SELECT
@var1:= IF(@var2 = table.value, @var1 + 1, 1)
@var2:= table.value
FROM table
I don't seem to be able to do comparisons (=,>,<,etc) on variables within the select portion of the statement.
EDIT: Changed the pseudo code to make more sense with my application.