select * from (select @rownum := @rownum+1 as rownum,goods_idfrom table_goods, (select @rownum:=0) t where test_id = 10) mwhere m.goods_id = 57806