MYSQL Update incl. ROUND failes in #1064
I want to perform a simple update my values with rounding them and substracting -1:
UPDATE
catalog_product_entity_decimal
SET
catalog_product_entity_decimal.value= round(catalog_product_entity_decimal.value,-1)-1
WHERE
catalog_product_entity_decimal.attribute_id="76";
The error is:
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 ')-1 FROMcatalog_product_entity_decimal
WHERE
catalog_product_entity_decimal.a' at line 1
What I am doing wrong?
mysql rounding mysql-error-1064
add a comment |
I want to perform a simple update my values with rounding them and substracting -1:
UPDATE
catalog_product_entity_decimal
SET
catalog_product_entity_decimal.value= round(catalog_product_entity_decimal.value,-1)-1
WHERE
catalog_product_entity_decimal.attribute_id="76";
The error is:
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 ')-1 FROMcatalog_product_entity_decimal
WHERE
catalog_product_entity_decimal.a' at line 1
What I am doing wrong?
mysql rounding mysql-error-1064
By usingROUND(.., -1)
, you are rounding to nearest tens. So, 11.5 will round to 10. Are you sure that you want to do this ?
– Madhur Bhaiya
Nov 23 '18 at 17:57
1
You are sure you posted right query? There are no syntax error in that query. Which version of MySQL are you using?
– DanB
Nov 23 '18 at 18:48
Yes - the query is right. My goal is to round every number to ending 9, that’s the reason I round to 10 and substract 1. But the error appears
– Fabian
Nov 24 '18 at 18:10
add a comment |
I want to perform a simple update my values with rounding them and substracting -1:
UPDATE
catalog_product_entity_decimal
SET
catalog_product_entity_decimal.value= round(catalog_product_entity_decimal.value,-1)-1
WHERE
catalog_product_entity_decimal.attribute_id="76";
The error is:
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 ')-1 FROMcatalog_product_entity_decimal
WHERE
catalog_product_entity_decimal.a' at line 1
What I am doing wrong?
mysql rounding mysql-error-1064
I want to perform a simple update my values with rounding them and substracting -1:
UPDATE
catalog_product_entity_decimal
SET
catalog_product_entity_decimal.value= round(catalog_product_entity_decimal.value,-1)-1
WHERE
catalog_product_entity_decimal.attribute_id="76";
The error is:
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 ')-1 FROMcatalog_product_entity_decimal
WHERE
catalog_product_entity_decimal.a' at line 1
What I am doing wrong?
mysql rounding mysql-error-1064
mysql rounding mysql-error-1064
edited Nov 23 '18 at 17:55
Madhur Bhaiya
19.5k62236
19.5k62236
asked Nov 23 '18 at 17:54
Fabian
1
1
By usingROUND(.., -1)
, you are rounding to nearest tens. So, 11.5 will round to 10. Are you sure that you want to do this ?
– Madhur Bhaiya
Nov 23 '18 at 17:57
1
You are sure you posted right query? There are no syntax error in that query. Which version of MySQL are you using?
– DanB
Nov 23 '18 at 18:48
Yes - the query is right. My goal is to round every number to ending 9, that’s the reason I round to 10 and substract 1. But the error appears
– Fabian
Nov 24 '18 at 18:10
add a comment |
By usingROUND(.., -1)
, you are rounding to nearest tens. So, 11.5 will round to 10. Are you sure that you want to do this ?
– Madhur Bhaiya
Nov 23 '18 at 17:57
1
You are sure you posted right query? There are no syntax error in that query. Which version of MySQL are you using?
– DanB
Nov 23 '18 at 18:48
Yes - the query is right. My goal is to round every number to ending 9, that’s the reason I round to 10 and substract 1. But the error appears
– Fabian
Nov 24 '18 at 18:10
By using
ROUND(.., -1)
, you are rounding to nearest tens. So, 11.5 will round to 10. Are you sure that you want to do this ?– Madhur Bhaiya
Nov 23 '18 at 17:57
By using
ROUND(.., -1)
, you are rounding to nearest tens. So, 11.5 will round to 10. Are you sure that you want to do this ?– Madhur Bhaiya
Nov 23 '18 at 17:57
1
1
You are sure you posted right query? There are no syntax error in that query. Which version of MySQL are you using?
– DanB
Nov 23 '18 at 18:48
You are sure you posted right query? There are no syntax error in that query. Which version of MySQL are you using?
– DanB
Nov 23 '18 at 18:48
Yes - the query is right. My goal is to round every number to ending 9, that’s the reason I round to 10 and substract 1. But the error appears
– Fabian
Nov 24 '18 at 18:10
Yes - the query is right. My goal is to round every number to ending 9, that’s the reason I round to 10 and substract 1. But the error appears
– Fabian
Nov 24 '18 at 18:10
add a comment |
0
active
oldest
votes
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53451116%2fmysql-update-incl-round-failes-in-1064%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53451116%2fmysql-update-incl-round-failes-in-1064%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
By using
ROUND(.., -1)
, you are rounding to nearest tens. So, 11.5 will round to 10. Are you sure that you want to do this ?– Madhur Bhaiya
Nov 23 '18 at 17:57
1
You are sure you posted right query? There are no syntax error in that query. Which version of MySQL are you using?
– DanB
Nov 23 '18 at 18:48
Yes - the query is right. My goal is to round every number to ending 9, that’s the reason I round to 10 and substract 1. But the error appears
– Fabian
Nov 24 '18 at 18:10