Database Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Codewalkers ForumsOther TechnologiesDatabase Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Codewalkers Forums Sponsor:
  #1  
Old December 10th, 2002, 11:14 PM
rxsid rxsid is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 86 rxsid User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 2
How to do a "selective" table UPDATE?

Hi all,

not sure how to word this..but here goes:

i have a table with a column of data type smallint.
how could i increase that number that's stored in the smallint by 1...only when certain pages or conditions are meet, in other words...an autoincrement is not wanted here because i don't want to increase that # by one each and every time the table is updated (for other columns).

is it possible to do an UPDATE (with a ++ on the column) on the table w/o first doing a SELECT to get the present number?

thanks!

Reply With Quote
  #2  
Old December 10th, 2002, 11:39 PM
bob0099 bob0099 is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: manchester,n.h.,usa
Posts: 172 bob0099 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 2
RE: How to do a

just tried an update.Use this syntax:

$query="UPDATE table SET field=field+1 WHERE otherfield = 'something'"

It worked for me.

Reply With Quote
  #3  
Old December 10th, 2002, 11:48 PM
rxsid rxsid is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 86 rxsid User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 2
RE: How to do a

very kewl...thanks bob.
didn't realize it would be so simple

Reply With Quote
Reply

Viewing: Codewalkers ForumsOther TechnologiesDatabase Help > How to do a "selective" table UPDATE?


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway
Stay green...Green IT