1

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.

1 Answers1

0

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
Fahmi
  • 37,315
  • 5
  • 22
  • 31