RE: [PHP-DB] adding to the current value

2005-09-29 Thread Bastien Koert

yes




From: Justin Turner [EMAIL PROTECTED]
To: php-db@lists.php.net
Subject: [PHP-DB] adding to the current value
Date: Thu, 29 Sep 2005 16:26:00 -0400

I would like to increment  the current value of a field X  without having 
to retrieve field X beforehand. Can I do this?


Example:

UPDATE my_table set field_1 = (current_field_value -1)  WHERE...blah, blah, 
blah


==
A. Justin Turner

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] adding to the current value

2005-09-29 Thread Justin Turner

How can I do this?

Bastien Koert wrote:


yes




From: Justin Turner [EMAIL PROTECTED]
To: php-db@lists.php.net
Subject: [PHP-DB] adding to the current value
Date: Thu, 29 Sep 2005 16:26:00 -0400

I would like to increment  the current value of a field X  without 
having to retrieve field X beforehand. Can I do this?


Example:

UPDATE my_table set field_1 = (current_field_value -1)  WHERE...blah, 
blah, blah


==
A. Justin Turner

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php





--

==
A. Justin Turner
ResNet Coordinator
University of Rochester
020 Gates Wing Susan B. Anthony Hall
[EMAIL PROTECTED]

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP-DB] adding to the current value

2005-09-29 Thread Hutchins, Richard
You do it by:

UPDATE my_table set field_1 = field_1 - 1 [...add any where statements here]

Bastien pretty much answered your question because the example you provided
was, in theory, correct. Besides, unless you're messing with a production
system, you could always just try out simple stuff like this on your own and
see what happens. More fun that way anyhow.

Rich

-Original Message-
From: Justin Turner [mailto:[EMAIL PROTECTED]
Sent: Thursday, September 29, 2005 5:04 PM
To: Bastien Koert
Cc: php-db@lists.php.net
Subject: Re: [PHP-DB] adding to the current value


How can I do this?

Bastien Koert wrote:

 yes



 From: Justin Turner [EMAIL PROTECTED]
 To: php-db@lists.php.net
 Subject: [PHP-DB] adding to the current value
 Date: Thu, 29 Sep 2005 16:26:00 -0400

 I would like to increment  the current value of a field X  without 
 having to retrieve field X beforehand. Can I do this?

 Example:

 UPDATE my_table set field_1 = (current_field_value -1)  WHERE...blah, 
 blah, blah

 ==
 A. Justin Turner

 -- 
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php



-- 

==
A. Justin Turner
ResNet Coordinator
University of Rochester
020 Gates Wing Susan B. Anthony Hall
[EMAIL PROTECTED]

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] adding to the current value

2005-09-29 Thread Justin Turner

...now don't I feel foolish. Thanks for your help.

Hutchins, Richard wrote:


You do it by:

UPDATE my_table set field_1 = field_1 - 1 [...add any where statements here]

Bastien pretty much answered your question because the example you provided
was, in theory, correct. Besides, unless you're messing with a production
system, you could always just try out simple stuff like this on your own and
see what happens. More fun that way anyhow.

Rich

-Original Message-
From: Justin Turner [mailto:[EMAIL PROTECTED]
Sent: Thursday, September 29, 2005 5:04 PM
To: Bastien Koert
Cc: php-db@lists.php.net
Subject: Re: [PHP-DB] adding to the current value


How can I do this?

Bastien Koert wrote:

 


yes



   


From: Justin Turner [EMAIL PROTECTED]
To: php-db@lists.php.net
Subject: [PHP-DB] adding to the current value
Date: Thu, 29 Sep 2005 16:26:00 -0400

I would like to increment  the current value of a field X  without 
having to retrieve field X beforehand. Can I do this?


Example:

UPDATE my_table set field_1 = (current_field_value -1)  WHERE...blah, 
blah, blah


==
A. Justin Turner

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

 



 



--

==
A. Justin Turner
ResNet Coordinator
University of Rochester
020 Gates Wing Susan B. Anthony Hall
[EMAIL PROTECTED]

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php