select table.*,@rn:[email protected]+1 as row_num from table,(select @rn:=0) as r order by field_you_like