The following statement updates a column in a table named ‘test’.
UPDATE test AS t
INNER JOIN test AS q ON(
q.ptime = t.ptime
)
SET t.slope_Percentile =(
(
SELECT
count(*)
FROM
(
SELECT
*
FROM
test
)AS t1
WHERE
t1.slope < t.slope
)* 100 /(
SELECT
count(*)
FROM
(
SELECT
*
FROM
test
) AS tz
)
);
Instead of updating the column I would like to receive a SELECT statement that gives a readout of each row (that would be updated if it was an UPDATE statement).
More information (if needed) about the nature of the tables and the goal of the code is here:
Efficient assignment of percentile/rank in MYSQL
1 Answer