somethings bothering me today and its how to insert my data in my table in a specific column. I don't know how so if anyone can help me I'd really really appreciate it.
my table(holidaytype) has the fields:
----------------------- |id |type |multiplier| | 1 | R | | | 2 | S | |
The id and type values must not be changed but the multiplier value will be coming from an input. I don't know what query should I be doing to do this.
I've tried :
INSERT INTO holidaytype(multiplier) SELECT multiplier FROM holidaytype WHERE `type` = 'R'
the results says : 1 row(s) affected Records: 1 Duplicates: 0 Warnings: 0 0.109 sec
What you are talking about is an
UPDATE, not an
INSERT. For example, if you wanted to make
multiplier be 10 for type
R, and 20 for type
S, you could do something like this:
UPDATE holidaytype SET multiplier = 10 WHERE `type` = 'R' UPDATE holidaytype SET multiplier = 20 WHERE `type` = 'S'
INSERT when you want to create entire new rows in a table. Any modifications to existing rows is done through