Click here to Skip to main content
15,904,817 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
my query as follows;
SQL
select * FROM Tb_SCh_TIme_Table P PIVOT (MAX(Faculty_Code) FOR Session IN ([1],[2],[3] ,[4])) AS PVT  where course = 'PH2' order by date;

when i run my above query the output as follows;
XML
 Date       Course      1      2      3     4

16/1/2013   PH2         GS
16/1/2013   PH2                             NR
16/1/2013   PH2                             CM

form my output i want the change as follows;
XML
 Date       Course      1      2      3     4

16/1/2013   PH2         GS
16/1/2013   PH2                            NR,CM

i want the faculty CM in same line 16/1/2013 date.dont want to faculty code CM in Next Line..

from my query how can i do. to Get my output correct.what changes is needed from my above query.

help me please.
Posted
Updated 22-Jan-13 19:53pm
v2

1 solution

Hi Member8054539,

Looks like you want to group rows, you can use the GROUPBY SQL keyword
* see more help on that.

And in the SELECT fields make a CONCAT to create the NR,CM column
* see more help[^] on that.

Cheers,
Edo
 
Share this answer
 
v3

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900