How to put comma seperater for a query which has repeated result output?
I have an sql query which is giving me some result,i have two columns one is outlet and other one is PENDINGINDENTNOS, so in my outlet i have one outlet coming more then one because it has different PENDINGINDENTNOS
for less confusion see my query
select distinct(reorderno) as PENDINGINDENTNOS,outlet from syncolindentfromreorder;
It is giving me result like
what i want is WF should come only once and there values 2 and 3 should come as 2,3 and these all outlets are comming from db now in my record i have WF Two times it can me thrice or four times for any outlets.
I want this result from query end only because i am populating table (HTML TABLE) with the help of JSP.
SO any one have any idea please Help me out.
mysql
add a comment |
I have an sql query which is giving me some result,i have two columns one is outlet and other one is PENDINGINDENTNOS, so in my outlet i have one outlet coming more then one because it has different PENDINGINDENTNOS
for less confusion see my query
select distinct(reorderno) as PENDINGINDENTNOS,outlet from syncolindentfromreorder;
It is giving me result like
what i want is WF should come only once and there values 2 and 3 should come as 2,3 and these all outlets are comming from db now in my record i have WF Two times it can me thrice or four times for any outlets.
I want this result from query end only because i am populating table (HTML TABLE) with the help of JSP.
SO any one have any idea please Help me out.
mysql
select group_concat(reorderno) as PENDINGINDENTNOS,outlet from syncolindentfromreorder group by outlet;
– Vishw Patel
Nov 13 '18 at 5:57
there is already an answer @VishwPatel posted 2 mins ago before your comments
– fa06
Nov 13 '18 at 5:58
add a comment |
I have an sql query which is giving me some result,i have two columns one is outlet and other one is PENDINGINDENTNOS, so in my outlet i have one outlet coming more then one because it has different PENDINGINDENTNOS
for less confusion see my query
select distinct(reorderno) as PENDINGINDENTNOS,outlet from syncolindentfromreorder;
It is giving me result like
what i want is WF should come only once and there values 2 and 3 should come as 2,3 and these all outlets are comming from db now in my record i have WF Two times it can me thrice or four times for any outlets.
I want this result from query end only because i am populating table (HTML TABLE) with the help of JSP.
SO any one have any idea please Help me out.
mysql
I have an sql query which is giving me some result,i have two columns one is outlet and other one is PENDINGINDENTNOS, so in my outlet i have one outlet coming more then one because it has different PENDINGINDENTNOS
for less confusion see my query
select distinct(reorderno) as PENDINGINDENTNOS,outlet from syncolindentfromreorder;
It is giving me result like
what i want is WF should come only once and there values 2 and 3 should come as 2,3 and these all outlets are comming from db now in my record i have WF Two times it can me thrice or four times for any outlets.
I want this result from query end only because i am populating table (HTML TABLE) with the help of JSP.
SO any one have any idea please Help me out.
mysql
mysql
asked Nov 13 '18 at 5:54
dheeraj kumardheeraj kumar
43411
43411
select group_concat(reorderno) as PENDINGINDENTNOS,outlet from syncolindentfromreorder group by outlet;
– Vishw Patel
Nov 13 '18 at 5:57
there is already an answer @VishwPatel posted 2 mins ago before your comments
– fa06
Nov 13 '18 at 5:58
add a comment |
select group_concat(reorderno) as PENDINGINDENTNOS,outlet from syncolindentfromreorder group by outlet;
– Vishw Patel
Nov 13 '18 at 5:57
there is already an answer @VishwPatel posted 2 mins ago before your comments
– fa06
Nov 13 '18 at 5:58
select group_concat(reorderno) as PENDINGINDENTNOS,outlet from syncolindentfromreorder group by outlet;
– Vishw Patel
Nov 13 '18 at 5:57
select group_concat(reorderno) as PENDINGINDENTNOS,outlet from syncolindentfromreorder group by outlet;
– Vishw Patel
Nov 13 '18 at 5:57
there is already an answer @VishwPatel posted 2 mins ago before your comments
– fa06
Nov 13 '18 at 5:58
there is already an answer @VishwPatel posted 2 mins ago before your comments
– fa06
Nov 13 '18 at 5:58
add a comment |
1 Answer
1
active
oldest
votes
You can try using group_concat()
select outlet,group_concat(distinct reorderno ORDER BY reorderno ASC SEPARATOR ',') as PENDINGINDENTNOS
from syncolindentfromreorder
group by outlet
OUTPUT:
name PENDINGINDENTNOS
Afcs 1
DF 2
WK 2,3
its giving some diff result, like very different
– dheeraj kumar
Nov 13 '18 at 5:58
what it is showing @dheerajkumar
– fa06
Nov 13 '18 at 5:59
should i edit my question with the image of your query result?
– dheeraj kumar
Nov 13 '18 at 6:00
@dheerajkumar, you can
– fa06
Nov 13 '18 at 6:01
1
@dheerajkumar addorder by reorderno
togroup_concat(..)
– Madhur Bhaiya
Nov 13 '18 at 6:07
|
show 3 more comments
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%2f53274650%2fhow-to-put-comma-seperater-for-a-query-which-has-repeated-result-output%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
You can try using group_concat()
select outlet,group_concat(distinct reorderno ORDER BY reorderno ASC SEPARATOR ',') as PENDINGINDENTNOS
from syncolindentfromreorder
group by outlet
OUTPUT:
name PENDINGINDENTNOS
Afcs 1
DF 2
WK 2,3
its giving some diff result, like very different
– dheeraj kumar
Nov 13 '18 at 5:58
what it is showing @dheerajkumar
– fa06
Nov 13 '18 at 5:59
should i edit my question with the image of your query result?
– dheeraj kumar
Nov 13 '18 at 6:00
@dheerajkumar, you can
– fa06
Nov 13 '18 at 6:01
1
@dheerajkumar addorder by reorderno
togroup_concat(..)
– Madhur Bhaiya
Nov 13 '18 at 6:07
|
show 3 more comments
You can try using group_concat()
select outlet,group_concat(distinct reorderno ORDER BY reorderno ASC SEPARATOR ',') as PENDINGINDENTNOS
from syncolindentfromreorder
group by outlet
OUTPUT:
name PENDINGINDENTNOS
Afcs 1
DF 2
WK 2,3
its giving some diff result, like very different
– dheeraj kumar
Nov 13 '18 at 5:58
what it is showing @dheerajkumar
– fa06
Nov 13 '18 at 5:59
should i edit my question with the image of your query result?
– dheeraj kumar
Nov 13 '18 at 6:00
@dheerajkumar, you can
– fa06
Nov 13 '18 at 6:01
1
@dheerajkumar addorder by reorderno
togroup_concat(..)
– Madhur Bhaiya
Nov 13 '18 at 6:07
|
show 3 more comments
You can try using group_concat()
select outlet,group_concat(distinct reorderno ORDER BY reorderno ASC SEPARATOR ',') as PENDINGINDENTNOS
from syncolindentfromreorder
group by outlet
OUTPUT:
name PENDINGINDENTNOS
Afcs 1
DF 2
WK 2,3
You can try using group_concat()
select outlet,group_concat(distinct reorderno ORDER BY reorderno ASC SEPARATOR ',') as PENDINGINDENTNOS
from syncolindentfromreorder
group by outlet
OUTPUT:
name PENDINGINDENTNOS
Afcs 1
DF 2
WK 2,3
edited Nov 13 '18 at 6:16
answered Nov 13 '18 at 5:55
fa06fa06
12.7k2917
12.7k2917
its giving some diff result, like very different
– dheeraj kumar
Nov 13 '18 at 5:58
what it is showing @dheerajkumar
– fa06
Nov 13 '18 at 5:59
should i edit my question with the image of your query result?
– dheeraj kumar
Nov 13 '18 at 6:00
@dheerajkumar, you can
– fa06
Nov 13 '18 at 6:01
1
@dheerajkumar addorder by reorderno
togroup_concat(..)
– Madhur Bhaiya
Nov 13 '18 at 6:07
|
show 3 more comments
its giving some diff result, like very different
– dheeraj kumar
Nov 13 '18 at 5:58
what it is showing @dheerajkumar
– fa06
Nov 13 '18 at 5:59
should i edit my question with the image of your query result?
– dheeraj kumar
Nov 13 '18 at 6:00
@dheerajkumar, you can
– fa06
Nov 13 '18 at 6:01
1
@dheerajkumar addorder by reorderno
togroup_concat(..)
– Madhur Bhaiya
Nov 13 '18 at 6:07
its giving some diff result, like very different
– dheeraj kumar
Nov 13 '18 at 5:58
its giving some diff result, like very different
– dheeraj kumar
Nov 13 '18 at 5:58
what it is showing @dheerajkumar
– fa06
Nov 13 '18 at 5:59
what it is showing @dheerajkumar
– fa06
Nov 13 '18 at 5:59
should i edit my question with the image of your query result?
– dheeraj kumar
Nov 13 '18 at 6:00
should i edit my question with the image of your query result?
– dheeraj kumar
Nov 13 '18 at 6:00
@dheerajkumar, you can
– fa06
Nov 13 '18 at 6:01
@dheerajkumar, you can
– fa06
Nov 13 '18 at 6:01
1
1
@dheerajkumar add
order by reorderno
to group_concat(..)
– Madhur Bhaiya
Nov 13 '18 at 6:07
@dheerajkumar add
order by reorderno
to group_concat(..)
– Madhur Bhaiya
Nov 13 '18 at 6:07
|
show 3 more comments
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.
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%2f53274650%2fhow-to-put-comma-seperater-for-a-query-which-has-repeated-result-output%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
select group_concat(reorderno) as PENDINGINDENTNOS,outlet from syncolindentfromreorder group by outlet;
– Vishw Patel
Nov 13 '18 at 5:57
there is already an answer @VishwPatel posted 2 mins ago before your comments
– fa06
Nov 13 '18 at 5:58