March 31, 2017 at 12:53 pm
The Inventory table has a Price column that contains prices for Cigarettes in the DB.
Tomorrow, California impliments a $2.00 increase on all Cigs, per pack. Most if not all brands are different prices.
Google no help. Isnt there an ADD(Price, 2) option to perform this quickly?
Thank you guys and gals
UPDATE Inventory
SET Price = Price + 2
where Dept_ID = '1123' ;1123 = Cigarette Pack Department ID
I run that and I get (0 row(s) affected)
March 31, 2017 at 1:00 pm
chef423 - Friday, March 31, 2017 12:53 PMThe Inventory table has a Price column that contains prices for Cigarettes in the DB.Tomorrow, California impliments a $2.00 increase on all Cigs, per pack. Most if not all brands are different prices.
Google no help. Isnt there an ADD(Price, 2) option to perform this quickly?
Thank you guys and gals
UPDATE Inventory
SET Price = Price + 2
where Dept_ID = '1123'
What's wrong with the code you posted?
March 31, 2017 at 1:04 pm
Updated code:
UPDATE Inventory
SET Price = Price + 2
where Dept_ID = '1123' and Price > '0.00'
This actually works.
March 31, 2017 at 1:16 pm
chef423 - Friday, March 31, 2017 1:04 PMUpdated code:
UPDATE Inventory
SET Price = Price + 2
where Dept_ID = '1123' and Price > '0.00'This actually works.
As Price is numeric, there is no need to put quotes around it in the WHERE clause.
The absence of evidence is not evidence of absence.
Martin Rees
You can lead a horse to water, but a pencil must be lead.
Stan Laurel
March 31, 2017 at 3:53 pm
I don't know if it has anything to do with the problem but why do you keep using string literals for columns that are not character based datatypes?
Heh... and I also think it hilarious that people keep picking on smokers but won't put a 10 cent bottle return on bottled water.
--Jeff Moden
Change is inevitable... Change for the better is not.
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply