David, try
1) create temporary table x (a INT PRIMARY KEY AUTO_INCREMENT) [select_statement] where [select_statement] is some legal select statement, presumebly select g.Description,sum(i.Retail_Value) from Groups g, Item i where i.Group_ID =g.Group_ID and i.Group_ID <> 0 group by i.Group_ID order by i.Category_ID; then 2) select * from x When you close the connection the trmporary table x will be removed. The same temporary table name can be used for multiple connections. Otherwise get the resultset into your application, and then increment a counter in a for/while loop etc Regards, Dan > -----Original Message----- > From: David S. Jackson [mailto:[EMAIL PROTECTED]] > Sent: Friday, 15 February 2002 12:08 p.m. > To: [EMAIL PROTECTED] > Subject: Re: how do you increment a field on the fly? > > > How do you add a column that increments on the fly those fields > you've selected to print in a mysql query? > > Example: > > select count(g.Group_ID) as Number, g.Description, > sum(i.Retail_Value) from Groups g, Item i where i.Group_ID = > g.Group_ID and i.Group_ID <> 0 group by i.Group_ID order by > i.Category_ID; > > My intention was to have the Number field simple be a number that > increments by one for each line that prints out. But, of course, > the documentation says that's not what the "count" function is > for. > > How can I add a simple little old line counter? > > -- > David S. Jackson [EMAIL PROTECTED] > =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= > I put instant coffee in a microwave and almost went > back in time. -- Steven Wright > > > -- > David S. Jackson [EMAIL PROTECTED] > =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= > I'm not afraid of death -- I just don't want to be > there when it happens. > -- Woody Allen > > --------------------------------------------------------------------- > 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