SQLize Online / PHPize Online  /  SQLtest Online

A A A
Share      Blog   Popular
Copy Format Clear
create table t ( article_id int, id int ); insert into t values (50, 1), (50, 2), (50, 3); SELECT if(id = max, min, id) as next FROM t, (select max(id) as max, min(id) as min from t where article_id = 50) as m WHERE article_id = 50 AND id > 2 LIMIT 1;
Stuck with a problem? Got Error? Ask ChatGPT!
Copy Clear