Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- set @last='';
- set @sort=NULL;
- update conf_profile set sort=
- if(
- @last=(@last:=concat(org_id,',',profile_type_id,',',page,',',col)),
- (@sort:=@sort+1),
- (@sort:=0)
- )
- order by org_id,profile_type_id,page,col,sort,id;
- mysql> set @sort := NULL;
- mysql> SELECT @sort; -- returns NULL
- mysql> set @sort := @sort + 1;
- mysql> SELECT @sort; -- returns NULL again
- mysql> set @sort := 0;
- mysql> set @sort := @sort + 1;
- mysql> SELECT @sort; -- returns 1
- set @last='';
- -- set @sort=NULL;
- update conf_profile set sort=
- if(
- @last!=(@last:=concat(org_id,',',profile_type_id,',',page,',',col)),
- (@sort:=0),
- (@sort:=@sort+1)
- )
- order by org_id,profile_type_id,page,col,sort,id;
Add Comment
Please, Sign In to add comment