Re: display each row number

Jess Balint <[email protected]>
Newsgroups gmane.comp.db.mysql.odbc
Message-ID <[email protected]>
On Sat, Apr 07, 2007 at 06:00:26PM +0800, [email protected] wrote:
> i want to display the each data row number ( exp. 1,2,3,4,5...) what is the sql command can i use. if exp i write ' select * from UserInfo where companyname = '12990-x' '

David,

There is no native row number in MySQL. If you just want to number the
rows as you retrieve them, you can just increment as you go, ex:

  int i;
  /* hStmt already ready to fetch rows */
  for(i = i; SQL_SUCCEEDED(SQLFetch(stmt)); ++i) {
	printf("This is row number %d\n", i);
	/* SQLGetData() or something here to get results */
  }

Jess

-- 
MySQL ODBC Mailing List
For list archives: http://lists.mysql.com/myodbc
To unsubscribe:    http://lists.mysql.com/[email protected]
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.