我试过但输出没有正确显示 [英] I tried but output is not showing correctly
本文介绍了我试过但输出没有正确显示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
查询如下
SELECT教师,'('+ [课程] +' - S'+ [会话] +' - '+ rtrim(ltrim( [主题]))+')'
来自Tb_Sch_Time_Table的
,其中Active<> 'D'
当我按如下方式执行查询输出时
CMK(B Tech1-S1- Eng)
CMK(B Tech2-S2-Tam)
但我希望输出如下
CMK(B Tech1-S1-Eng,B Tech2-S2-Tam)
获取以上输出如何编写代码请帮帮我。
Query as follows
SELECT faculty,'(' + [Course] + '-S' + [Session] + '-' + rtrim(ltrim([Subject])) + ')'
from Tb_Sch_Time_Table where Active <> 'D'
When i execute the query output as follows
CMK (B Tech1-S1-Eng)
CMK (B Tech2-S2-Tam)
But i want the output as follows
CMK (B Tech1-S1-Eng,B Tech2-S2-Tam)
for getting above output how can i write the code please help me.
推荐答案
我们无法给你一个准确的答案,因为那里没有足够的信息。
基本上,您需要使用STUFF,可能使用GROUP BY:
http://stackoverflow.com/questions/16922073/use-coalesce-with-group-by [ ^ ]
We can't give you a precise answer, because there just isn't anywhere near enough information there.
Basically, you need to use STUFF, probably with GROUP BY:
http://stackoverflow.com/questions/16922073/use-coalesce-with-group-by[^]
这篇关于我试过但输出没有正确显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文