Hi Peter,
I'm not sure but I don't think it's possible with MySQL. The best you could
do is make sure you have a primary key on the table that is autoincrement.
This will give you a unique number for each row.
RowNum is very subjective since it is describing the row number in the
cursor you are looking at in. Most RDBMS' do not assign (or at least do not
expose) a table level row number.
If you absolutely must have one then you have 2 options that I can see.
1: Create a field in your table and assign it manually. This works at the
table level but is fairly useless info at the cursor level.
2; Do it in your procedural language. As you said, it's trivial to implement
in PHP and IMHO that's where it should be done.
Cal
http://www.calevans.com
-----Original Message-----
From: Peter Holm [mailto:[EMAIL PROTECTED]]
Sent: Sunday, March 18, 2001 11:05 AM
To: [EMAIL PROTECTED]
Subject: ROWNUM???
Hi,
how do I get something like ROWNUM with mysql?
This means, before every row in a result there would be the Number of
the row. I want a result that looks like this:
No | xyz | abc |
-------------------------------
1| xyz | abc |
2| xyz | abc |
3| xyz | abc |
.
.
.
10| xyz | abc |
I tried to use variables (@a++) for this, but this does not work.
Is there a way to do this (without a procedural language... I know it is
easy to do with perl or php, but I am using mysql commandline utility a
lot for formatting of results...)
THANKS for answers!
Have a nice thread,
Peter
---------------------------------------------------------------------
Before posting, please check:
http://www.mysql.com/manual.php (the manual)
http://lists.mysql.com/ (the list archive)
To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
---------------------------------------------------------------------
Before posting, please check:
http://www.mysql.com/manual.php (the manual)
http://lists.mysql.com/ (the list archive)
To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php