newbie: increment an existing record

2004-03-19 Thread miasmo
Is there a mysql command that will increment the value of a field in an 
existing row? I would think this would be pretty basic, but I can't 
seem to find anything in the online documentation.

Thanks,
Jim
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]


Re: newbie: increment an existing record

2004-03-19 Thread Sasha Pachev
[EMAIL PROTECTED] wrote:
Is there a mysql command that will increment the value of a field in an 
existing row? I would think this would be pretty basic, but I can't seem 
to find anything in the online documentation.
update t1 set f = f + 1



--
Sasha Pachev
Create online surveys at http://www.surveyz.com/
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]


Re: newbie: increment an existing record

2004-03-19 Thread beacker
 Is there a mysql command that will increment the value of a field in an 
 existing row? I would think this would be pretty basic, but I can't seem 
 to find anything in the online documentation.

update t1 set f = f + 1

 Unfortunately that will update all the records in the database.  It's
likely he would prefer to update a particular record via

update t1 set f = f + 1 where id = 1234;

Which will update only the record matching the id of 1234.
   Brad Eacker ([EMAIL PROTECTED])



-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



Re: newbie: increment an existing record

2004-03-19 Thread miasmo
Brad

That is indeed what I ended up doing, and it worked. Thanks.

Jim

On Friday, March 19, 2004, at 02:07 PM, [EMAIL PROTECTED] wrote:

Is there a mysql command that will increment the value of a field in 
an
existing row? I would think this would be pretty basic, but I can't 
seem
to find anything in the online documentation.
update t1 set f = f + 1
 Unfortunately that will update all the records in the database.  
It's
likely he would prefer to update a particular record via

update t1 set f = f + 1 where id = 1234;

Which will update only the record matching the id of 1234.
   Brad Eacker ([EMAIL PROTECTED])



--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]


Re: newbie: increment an existing record

2004-03-19 Thread Brad Eacker
Jim [EMAIL PROTECTED] writes:
 It's likely he would prefer to update a particular record via

 update t1 set f = f + 1 where id = 1234;

 Which will update only the record matching the id of 1234.

That is indeed what I ended up doing, and it worked. Thanks.

Jim,
 It's good to hear that you were able to accomplish your
desired results.  Now if I could just figure out how to get a
job based upon the knowledge that I've built up over the last
decade of working with various RDBMS systems, coupled with over
9 years of web/back-end integration, and 13 years of Unix kernel
internal development experience.

 You may want to take a look at Teach Yourself SQL in 21 Days
by Stephens and Plew, Sams Publishing ISBN 0-672-31674-9 for the
copy that I have in front of me.  It does a good job of explaining
these kinds of questions.
 Brad Eacker ([EMAIL PROTECTED])



-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]