mysql select increment variables (including reading the first few lines of the current)

mysql select increment variables (including reading the first few lines of the current)

SET @rownum =0;
select id,@rownum := @rownum +1 as i from ceshi order by dd desc,id desc;

Variable is the direct output of the result set


SET @rownum =0;

@rownum: = 1
This variable is assigned 2 all the way

= 0 @rownum the SET;
SELECT I from
(SELECT ID, dd, rownum @: I = AS + 1'd @rownum from ceshi Order by desc dd, ID desc) WHERE ID = AS CC. 4;
this query a user of the first of several

But mysql seemingly no way to execute multiple statements so see it

Guess you like

Origin www.cnblogs.com/newmiracle/p/11856284.html