mysql concat on columns name












0














hi I'm just starting to learn sql and I wish to combine the columns into one using concat but didn't manage to do it. I can run the code without concat but when when I use concat it gives me an error code. Can anyone tell me what am I doing wrong?



SELECT CONCAT('A purchase with the purchase ID of' AS "Constraint",
ONLINEPURCHASE.PurchaseID AS "OLID", 'is an online purchase of type' AS "Condition", ONLINEPURCHASE.OnlineType AS "OLType", 'and also a walkin purchase of location' AS "Condition", WALKINPURCHASE.ShopLocation AS "ShopLocation")
FROM ONLINEPURCHASE JOIN WALKINPURCHASE
ON ONLINEPURCHASE.PurchaseID = WALKINPURCHASE.PurchaseID
WHERE WALKINPURCHASE.PurchaseID IN (SELECT PurchaseID
FROM WALKINPURCHASE);


But got this error (ERROR 1583 (42000): Incorrect parameters in the call to native function 'concat')










share|improve this question
























  • I see, sorry I'm quite new to this will work on it thanks.
    – jason1368
    Nov 19 '18 at 18:40










  • You are missing a closing ) in the CONCAT function..
    – Raymond Nijland
    Nov 19 '18 at 19:05


















0














hi I'm just starting to learn sql and I wish to combine the columns into one using concat but didn't manage to do it. I can run the code without concat but when when I use concat it gives me an error code. Can anyone tell me what am I doing wrong?



SELECT CONCAT('A purchase with the purchase ID of' AS "Constraint",
ONLINEPURCHASE.PurchaseID AS "OLID", 'is an online purchase of type' AS "Condition", ONLINEPURCHASE.OnlineType AS "OLType", 'and also a walkin purchase of location' AS "Condition", WALKINPURCHASE.ShopLocation AS "ShopLocation")
FROM ONLINEPURCHASE JOIN WALKINPURCHASE
ON ONLINEPURCHASE.PurchaseID = WALKINPURCHASE.PurchaseID
WHERE WALKINPURCHASE.PurchaseID IN (SELECT PurchaseID
FROM WALKINPURCHASE);


But got this error (ERROR 1583 (42000): Incorrect parameters in the call to native function 'concat')










share|improve this question
























  • I see, sorry I'm quite new to this will work on it thanks.
    – jason1368
    Nov 19 '18 at 18:40










  • You are missing a closing ) in the CONCAT function..
    – Raymond Nijland
    Nov 19 '18 at 19:05
















0












0








0







hi I'm just starting to learn sql and I wish to combine the columns into one using concat but didn't manage to do it. I can run the code without concat but when when I use concat it gives me an error code. Can anyone tell me what am I doing wrong?



SELECT CONCAT('A purchase with the purchase ID of' AS "Constraint",
ONLINEPURCHASE.PurchaseID AS "OLID", 'is an online purchase of type' AS "Condition", ONLINEPURCHASE.OnlineType AS "OLType", 'and also a walkin purchase of location' AS "Condition", WALKINPURCHASE.ShopLocation AS "ShopLocation")
FROM ONLINEPURCHASE JOIN WALKINPURCHASE
ON ONLINEPURCHASE.PurchaseID = WALKINPURCHASE.PurchaseID
WHERE WALKINPURCHASE.PurchaseID IN (SELECT PurchaseID
FROM WALKINPURCHASE);


But got this error (ERROR 1583 (42000): Incorrect parameters in the call to native function 'concat')










share|improve this question















hi I'm just starting to learn sql and I wish to combine the columns into one using concat but didn't manage to do it. I can run the code without concat but when when I use concat it gives me an error code. Can anyone tell me what am I doing wrong?



SELECT CONCAT('A purchase with the purchase ID of' AS "Constraint",
ONLINEPURCHASE.PurchaseID AS "OLID", 'is an online purchase of type' AS "Condition", ONLINEPURCHASE.OnlineType AS "OLType", 'and also a walkin purchase of location' AS "Condition", WALKINPURCHASE.ShopLocation AS "ShopLocation")
FROM ONLINEPURCHASE JOIN WALKINPURCHASE
ON ONLINEPURCHASE.PurchaseID = WALKINPURCHASE.PurchaseID
WHERE WALKINPURCHASE.PurchaseID IN (SELECT PurchaseID
FROM WALKINPURCHASE);


But got this error (ERROR 1583 (42000): Incorrect parameters in the call to native function 'concat')







mysql concat






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 19 '18 at 18:37







jason1368

















asked Nov 19 '18 at 18:36









jason1368jason1368

103




103












  • I see, sorry I'm quite new to this will work on it thanks.
    – jason1368
    Nov 19 '18 at 18:40










  • You are missing a closing ) in the CONCAT function..
    – Raymond Nijland
    Nov 19 '18 at 19:05




















  • I see, sorry I'm quite new to this will work on it thanks.
    – jason1368
    Nov 19 '18 at 18:40










  • You are missing a closing ) in the CONCAT function..
    – Raymond Nijland
    Nov 19 '18 at 19:05


















I see, sorry I'm quite new to this will work on it thanks.
– jason1368
Nov 19 '18 at 18:40




I see, sorry I'm quite new to this will work on it thanks.
– jason1368
Nov 19 '18 at 18:40












You are missing a closing ) in the CONCAT function..
– Raymond Nijland
Nov 19 '18 at 19:05






You are missing a closing ) in the CONCAT function..
– Raymond Nijland
Nov 19 '18 at 19:05














1 Answer
1






active

oldest

votes


















0














Congratulations on starting to learn SQL, it's super useful! Let me try to clear up your misunderstanding.



The CONCAT function takes some number of either strings or column values and joins them together. There's no need to use the AS keyword within it.



Here's what I think you're looking for:



SELECT
CONCAT(
'A purchase with the purchase ID of',
ONLINEPURCHASE.PurchaseID,
'is an online purchase of type',
ONLINEPURCHASE.OnlineType,
'and also a walkin purchase of location',
WALKINPURCHASE.ShopLocation
) AS result
FROM ONLINEPURCHASE JOIN WALKINPURCHASE
ON ONLINEPURCHASE.PurchaseID = WALKINPURCHASE.PurchaseID
WHERE WALKINPURCHASE.PurchaseID IN
(SELECT PurchaseID FROM WALKINPURCHASE);


This will create the sentence you're building in the CONCAT statement and return it as a single column of your result set. (I've used the AS keyword to rename the column you've built.)



Please let me know if you have any questions about this.






share|improve this answer





















  • Thank you so much for clarifying. I have a better understanding now.
    – jason1368
    Nov 20 '18 at 3:36











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
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53380734%2fmysql-concat-on-columns-name%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









0














Congratulations on starting to learn SQL, it's super useful! Let me try to clear up your misunderstanding.



The CONCAT function takes some number of either strings or column values and joins them together. There's no need to use the AS keyword within it.



Here's what I think you're looking for:



SELECT
CONCAT(
'A purchase with the purchase ID of',
ONLINEPURCHASE.PurchaseID,
'is an online purchase of type',
ONLINEPURCHASE.OnlineType,
'and also a walkin purchase of location',
WALKINPURCHASE.ShopLocation
) AS result
FROM ONLINEPURCHASE JOIN WALKINPURCHASE
ON ONLINEPURCHASE.PurchaseID = WALKINPURCHASE.PurchaseID
WHERE WALKINPURCHASE.PurchaseID IN
(SELECT PurchaseID FROM WALKINPURCHASE);


This will create the sentence you're building in the CONCAT statement and return it as a single column of your result set. (I've used the AS keyword to rename the column you've built.)



Please let me know if you have any questions about this.






share|improve this answer





















  • Thank you so much for clarifying. I have a better understanding now.
    – jason1368
    Nov 20 '18 at 3:36
















0














Congratulations on starting to learn SQL, it's super useful! Let me try to clear up your misunderstanding.



The CONCAT function takes some number of either strings or column values and joins them together. There's no need to use the AS keyword within it.



Here's what I think you're looking for:



SELECT
CONCAT(
'A purchase with the purchase ID of',
ONLINEPURCHASE.PurchaseID,
'is an online purchase of type',
ONLINEPURCHASE.OnlineType,
'and also a walkin purchase of location',
WALKINPURCHASE.ShopLocation
) AS result
FROM ONLINEPURCHASE JOIN WALKINPURCHASE
ON ONLINEPURCHASE.PurchaseID = WALKINPURCHASE.PurchaseID
WHERE WALKINPURCHASE.PurchaseID IN
(SELECT PurchaseID FROM WALKINPURCHASE);


This will create the sentence you're building in the CONCAT statement and return it as a single column of your result set. (I've used the AS keyword to rename the column you've built.)



Please let me know if you have any questions about this.






share|improve this answer





















  • Thank you so much for clarifying. I have a better understanding now.
    – jason1368
    Nov 20 '18 at 3:36














0












0








0






Congratulations on starting to learn SQL, it's super useful! Let me try to clear up your misunderstanding.



The CONCAT function takes some number of either strings or column values and joins them together. There's no need to use the AS keyword within it.



Here's what I think you're looking for:



SELECT
CONCAT(
'A purchase with the purchase ID of',
ONLINEPURCHASE.PurchaseID,
'is an online purchase of type',
ONLINEPURCHASE.OnlineType,
'and also a walkin purchase of location',
WALKINPURCHASE.ShopLocation
) AS result
FROM ONLINEPURCHASE JOIN WALKINPURCHASE
ON ONLINEPURCHASE.PurchaseID = WALKINPURCHASE.PurchaseID
WHERE WALKINPURCHASE.PurchaseID IN
(SELECT PurchaseID FROM WALKINPURCHASE);


This will create the sentence you're building in the CONCAT statement and return it as a single column of your result set. (I've used the AS keyword to rename the column you've built.)



Please let me know if you have any questions about this.






share|improve this answer












Congratulations on starting to learn SQL, it's super useful! Let me try to clear up your misunderstanding.



The CONCAT function takes some number of either strings or column values and joins them together. There's no need to use the AS keyword within it.



Here's what I think you're looking for:



SELECT
CONCAT(
'A purchase with the purchase ID of',
ONLINEPURCHASE.PurchaseID,
'is an online purchase of type',
ONLINEPURCHASE.OnlineType,
'and also a walkin purchase of location',
WALKINPURCHASE.ShopLocation
) AS result
FROM ONLINEPURCHASE JOIN WALKINPURCHASE
ON ONLINEPURCHASE.PurchaseID = WALKINPURCHASE.PurchaseID
WHERE WALKINPURCHASE.PurchaseID IN
(SELECT PurchaseID FROM WALKINPURCHASE);


This will create the sentence you're building in the CONCAT statement and return it as a single column of your result set. (I've used the AS keyword to rename the column you've built.)



Please let me know if you have any questions about this.







share|improve this answer












share|improve this answer



share|improve this answer










answered Nov 19 '18 at 18:48









nviolinvioli

2,31631228




2,31631228












  • Thank you so much for clarifying. I have a better understanding now.
    – jason1368
    Nov 20 '18 at 3:36


















  • Thank you so much for clarifying. I have a better understanding now.
    – jason1368
    Nov 20 '18 at 3:36
















Thank you so much for clarifying. I have a better understanding now.
– jason1368
Nov 20 '18 at 3:36




Thank you so much for clarifying. I have a better understanding now.
– jason1368
Nov 20 '18 at 3:36


















draft saved

draft discarded




















































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.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53380734%2fmysql-concat-on-columns-name%23new-answer', 'question_page');
}
);

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







Popular posts from this blog

MongoDB - Not Authorized To Execute Command

in spring boot 2.1 many test slices are not allowed anymore due to multiple @BootstrapWith

Npm cannot find a required file even through it is in the searched directory