I need to do a join with a table/result-set/whatever that has the integers n
to m
inclusive. Is there a trivial way to get that without just buildi
SET @seq := 0;
SELECT @seq := FLOOR(@seq + 1) AS sequence, yt.*
FROM your_table yt;
SELECT @seq := FLOOR(@seq + 1) AS sequence, yt.*
FROM (SELECT @seq := 0) s, your_table yt;
The FLOOR()
function is used here to get an INTEGER
in place of a FLOAT
. Sometimes it is needed.
My answer was inspired by David Poor answer. Thanks David!