Get offset of a row from MYSQL database


SELECT * FROM (SELECT t.activity_id,t.user_id, @rownum := @rownum + 1 AS position FROM activity_log t JOIN (SELECT @rownum := 0) r ORDER BY t.activity_date desc) x WHERE x.activity_id = ‘111&…

Source: Get offset of a row from MYSQL database

Advertisements