Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how do i update a column value depending on a condition...

Status
Not open for further replies.

excession

Programmer
Sep 22, 2004
111
GB
I want to update the value in a column only if it is less than a supplied value.

for example if I had a table called autionItems containing a column called offers, I have got a new offer and need to update the autionItems table only if the new offer is greater than the existing value.

Thanks in advance

 
E.g.

Code:
update auctionItems 
  set offers = $newOffer
 where itemid = 4711
   and offers < $newOffer

where the variable $newOffer contains the new value.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top