mySQL

mySQL 퀴리 결과에 번호 매기기

코드버무려 2017. 2. 7. 17:50

결과 값에 번호를 부여하는 sql 구문


SELECT id, title, @rn:=@rn+1 AS num, user_id, thedate FROM atable, (SELECT @rn:=0) R ORDER BY thedate DESC;