How to make auto numbering ( row number ) in mysql query


SUBMITTED BY: Guest

DATE: Aug. 10, 2014, 2:50 a.m.

FORMAT: Text only

SIZE: 423 Bytes

HITS: 3268

  1. How to make auto numbering ( row number ) in mysql query
  2. ##for example
  3. tb_1
  4. ================
  5. name | sell | bonus
  6. aa | 2 | 4
  7. bb | 2 | 1
  8. cc | 2 | 1
  9. ##the query
  10. select @i:=@i+1 as no,name,sell,bonus from tb_1 join (select @i:=0) order by name
  11. ##the result
  12. no | name | sell | bonus
  13. 1 | aa | 2 | 4
  14. 2 | bb | 2 | 1
  15. 3 | cc | 2 | 1
  16. go and try... see you

comments powered by Disqus