Reputation: 505
I am new to SQL have a column containing house prices, with the house prices reported in cents instead of dollars. I would like to update the column values to their dollar value but haven't been able to figure out how to do so. I've tried:
INSERT INTO tiny_house_listings(price)
VALUES(SELECT (default_price/100) FROM tiny_house_listings);
and
UPDATE tiny_house_listings
SET price = (SELECT (default_price/100) FROM tiny_house_listings);
How does one typically go about accessing results sets returned in previous queries? Are they typically added as columns are is one able to access them via their aliased name? Would really appreciate any guidance on the subject!:)
Upvotes: 0
Views: 31
Reputation: 951
Maybe just this :
UPDATE tiny_house_listings
SET price = default_price/100;
Can you show us your table definition ?
Upvotes: 1