Search
 
SCRIPT & CODE EXAMPLE
 

SQL

mysql update sequence with order by

SET @rank:=0;
update tablename
set fieldname =@rank:=@rank+1 ORDER BY fieldorder;

#OR

UPDATE tablename
JOIN (SELECT @rank := 0) r
SET fieldname=@rank:=@rank+1 ORDER BY fieldorder;
Comment

PREVIOUS NEXT
Code Example
Sql :: sqlite3 not commit 
Sql :: ring MySQL get the inserted row id 
Sql :: shell script to log mysql cpu usage 
Sql :: sql how to display two atributes as one in sql 
Sql :: MySQL Min And As 
Sql :: mysql could not fetch tables 
Sql :: unable to open database database.db file is encrypted or is not a database 
Sql :: import sheets doc into databricks 
Sql :: how much space does sql server take per row 
Sql :: list of schema with sizes (relative and absolute) in a PostgreSQL database 
Sql :: find Overlapping sql 
Sql :: Split Column with delimiter into multiple columns 
Sql :: alasql delete column 
Sql :: check records older than 10 days 
Sql :: To Create directory 
Sql :: mysql default tls v1.3 ciphersuites 
Sql :: create user faunadb 
Sql :: oracle lower in where clause 
Sql :: how to fetch unique records from two tables 
Sql :: java nosql sort 
Sql :: sqlserver: reverse like search 
Sql :: order by monthly in sql 
Sql :: sqlite date to char 
Sql :: mysql password reset 
Sql :: pg_dump backup postgresql 
Sql :: hibernate xml property MySQL url, username and password 
Sql :: create trigger in phpmyadmin 
Sql :: how to fetch highest score in minimum time using mysql 
Sql :: sql server union if table exist 
Sql :: sql datediff db2 
ADD CONTENT
Topic
Content
Source link
Name
3+8 =