[prev in list] [next in list] [prev in thread] [next in thread] 

List:       mysql
Subject:    Re: mysql: SELECT row sequence column
From:       "Joshua J. Kugler" <jkugler () inreach ! com>
Date:       1998-03-31 6:23:19
[Download RAW message or body]

foreach (@arr=$sth->fetchrow)
	{
	$x++;
	print "$x\t$arr[0]\t$arr[1]\n";
	}

That should do it.  Of course, that's in Perl.  If you are looking to do it
in the SQL statement, I think you're out of luck.

j----- k-----

At 06:22 PM 3/30/98 -0400, Charlie Schleck allegedly said the following:
()How does one return the row count with the results of the query? For
()example:
()
()SELECT firstname, lastname WHERE lastname='Smith';
()
()Results:
()1    John    Smith
()2    Sam    Smith
()3    Steve    Smith
()
()It's the 1, 2, 3... column that I'm looking to produce.  I'm aware of how
()auto_increment works, but I don't feel that would be appropriate in this
()instance, since the field that has the auto_increment may have nothing to
()do with the sequence of a conditional query.
()
()
()
()

Joshua J. Kugler
Computer Consultant--Web Developer
jkugler@inreach.com
http://www.cwebpages.com/jkugler
My Peace comes from my relationship with my Lord and Savior Jesus Christ

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic