Created
October 2, 2013 13:44
-
-
Save jgdoncel/6794009 to your computer and use it in GitHub Desktop.
Numerar filas en una consulta
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# La siguiente consulta añade un campo numerado a una consulta: | |
set @num=0; | |
select id, @num:=@num+1 AS contando FROM tabla; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Actualizar un campo | |
set @num = 0; | |
update tabla SET campo=(SELECT @num:=@num+1) where id_grupo=10; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment