On 13 Jun 2002, at 2:07, Jeff Field wrote:
> I would like to have a column returned in a query that tells you which
> record I'm looking at? Sort of like an auto_increment? IOW, the
> query results would look like:
>
> record first last
>
> 1 john doe
> 2 joe blow
> 3 carol fisher
You could do something like
SET @i = 0;
SELECT @i = @i + 1 AS record, first, last FROM table_name;
But normally you'd just do it with a variable in Perl or PHP or C or
VB or whatever you're using to get the results, and not actually have
it be part of your query.
--
Keith C. Ivey <[EMAIL PROTECTED]>
Tobacco Documents Online
http://tobaccodocuments.org
---------------------------------------------------------------------
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