Update a column
| User, date | Message |
|---|---|
|
Written by MAC301
7 months ago Category: Running SQL scripts 8 posts since Sun, 21 Oct 12 |
I have a column/field 'policy_type' that have 'HO Prefe' that I need to correct to 'HOP'... I followed a previous post..How can I update some incorrect fields in a column? I keep getting a 1064 error?... Can anyone tell me what's wrong with this? Query: 1.SELECT * FROM quick_rates WHERE company_id=(6) 2.UPDATE quick_rates SET policy_type='HOP' WHERE policy_type='HO Prefe' |
|
Written by ansgar
7 months ago 3949 posts since Fri, 07 Apr 06 |
Second query looks right, while the first one should remove the parentheses around the (6). What about the full error message - you don't get just "sql error 1064". |
|
Written by MAC301
7 months ago 8 posts since Sun, 21 Oct 12 |
Thanks for the quick reply:.. here is the entire message: SQL Error (1064); You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'UPDATE quick_rates SET policy_type='HOP' WHERE policy_type='HO Prefe'at line 2 |
|
Written by MAC301
7 months ago 8 posts since Sun, 21 Oct 12 |
OH... Thanks.. Got it working.. when I highlight line 2 only it works! |
|
Written by jfalch
7 months ago 222 posts since Sat, 17 Oct 09 |
when you have more than on e sql statement in the query, you must eparate them with semcolon (;) or you get a systax error. EG: SELECT * FROM quick_rates WHERE company_id=6; UPDATE quick_rates SET policy_type='HOP' WHERE policy_type='HO Prefe' |
|
Written by MAC301
7 months ago 8 posts since Sun, 21 Oct 12 |
Yes... Thanks... works just fine now! |
|
Please login to leave a reply, or register at first. |