本文介绍了如何使用我的查询区分Faculty_code。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

从Tb_SCh_TIme_Table中选择课程,东西(选择'',''+ cast(SubQry.Faculty_Code as varchar(50))作为SubQry,其中SubQry.course = MainQry.course for XML Path(''')), 1,1,''''作为Faculty_Code

来自Tb_SCh_TIme_Table为MainQry

Group by MainQry.course


$ b当我运行输出时$ b;



课程Faculty_code



PH2 SJ,SJ,NR, SJ,NR

REO vk,RJ,RJ,NR,RJ,SJ





但我想要输出如下;



如何使用我的上述查询区分Faculty_code,我希望输出如下;



Course Faculty_code



PH2 SJ,NR

REO vk,NR,RJ,SJ





我该怎么办。请回复。我想要答案。使用我的查询如何区分

Faculty_Code。

select course, stuff((select '','' + cast(SubQry.Faculty_Code as varchar(50)) from Tb_SCh_TIme_Table As SubQry where SubQry.course = MainQry.course for XML Path('' '' )), 1, 1, '''') as Faculty_Code
from Tb_SCh_TIme_Table as MainQry
Group by MainQry.course

when i run output as follows;

Course Faculty_code

PH2 SJ,SJ,NR,SJ,NR
REO vk,RJ,RJ,NR,RJ,SJ


but i want the output as follows;

how to distinct the Faculty_code using my above query,i want the output as follows;

Course Faculty_code

PH2 SJ,NR
REO vk,NR,RJ,SJ


how can i do.please reply. i want the answer. using my query how to do distinct the
Faculty_Code.

推荐答案


这篇关于如何使用我的查询区分Faculty_code。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-30 07:00