I have no problem doing this with server variables ... here is an example that
I tried on the acc (account) table in our db ...

SET @a:=0;
SELECT @a:=@a+1 AS MyRowNum, acc.* FROM acc;

This gives me the result that you are looking for ...

Eric


Peter Holm wrote:

> 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

Reply via email to