SQLize Online / PHPize Online  /  SQLtest Online

A A A
Share      Blog   Popular
Copy Format Clear
create table routes (route_id int, trunk_id int, seq int); insert into routes values (16,117,0), (16,118,1), (16,120,2), (16,121,3); select * from routes; select @a := ifnull(@a, 1) + 1, seq = if(trunk_id = 118, 0, @a) from routes where route_id = 16 order by trunk_id = 118 desc, trunk_id; select * from routes;
Stuck with a problem? Got Error? Ask ChatGPT!
Copy Clear