SELECT @curRow := @curRow + 1 AS row_number FROM sometable JOIN (SELECT @curRow := 0) r WHERE @curRow<100;