display each row number

display each row number

am 07.04.2007 12:00:26 von david

----=_NextPart_000_000B_133C69D6771F43568C00406BB8C85FE3
Content-type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: quoted-printable

i want to display the each data row number ( exp. 1,2,3,4,5...) what is the sql command can i use. i=
f exp i write ' select * from UserInfo where companyname =3D '12990-x' '

Thank you

David



----=_NextPart_000_000B_133C69D6771F43568C00406BB8C85FE3
Content-Type: text/plain; charset=us-ascii


--
MySQL ODBC Mailing List
For list archives: http://lists.mysql.com/myodbc
To unsubscribe: http://lists.mysql.com/myodbc?unsub=gcdmo-myodbc@m.gmane.org
----=_NextPart_000_000B_133C69D6771F43568C00406BB8C85FE3--

Re: display each row number

am 07.04.2007 20:01:16 von Jess Balint

On Sat, Apr 07, 2007 at 06:00:26PM +0800, david@lakws.com 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/myodbc?unsub=gcdmo-myodbc@m.gmane.org