How to put comma seperater for a query which has repeated result output?










2















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



this is my result



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.










share|improve this question






















  • 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
















2















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



this is my result



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.










share|improve this question






















  • 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














2












2








2








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



this is my result



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.










share|improve this question














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



this is my result



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






share|improve this question













share|improve this question











share|improve this question




share|improve this question










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


















  • 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













1 Answer
1






active

oldest

votes


















1














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





share|improve this answer

























  • 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 add order by reorderno to group_concat(..)

    – Madhur Bhaiya
    Nov 13 '18 at 6:07










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%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









1














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





share|improve this answer

























  • 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 add order by reorderno to group_concat(..)

    – Madhur Bhaiya
    Nov 13 '18 at 6:07















1














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





share|improve this answer

























  • 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 add order by reorderno to group_concat(..)

    – Madhur Bhaiya
    Nov 13 '18 at 6:07













1












1








1







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





share|improve this answer















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






share|improve this answer














share|improve this answer



share|improve this answer








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 add order by reorderno to group_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











  • 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 add order by reorderno to group_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

















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.




draft saved


draft discarded














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





















































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

Use pre created SQLite database for Android project in kotlin

Darth Vader #20

Ondo