For example, I have a query:
SELECT id, subid, alias FROM table WHERE id IN ( 2, 8, 4, 7 ) ORDER by id I need to get every line found and save it to a temporary variable in order to compare it with the next found sample line like @result = IF( @old.subid == @new.id , true, false) . How to implement it in a mysql query?