如何在SQL Server中的一个列中选择多个子列 [英] How to select multiple sub columns into one single Column in SQL Server
本文介绍了如何在SQL Server中的一个列中选择多个子列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想在sql server中的一个表列中选择多个列,例如,
Hi,
I want to select multiple columns into one single table column in sql server like,
| COLUMN 1 | COLUMN 2 | COLUMN 3 | COLUMN 4 |
------------------------------------------------------------------
| | | | SUB COL1 | SUB COL2 | SUB COL3|
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
在此图中,第4列包含三个子列。有没有办法得到这样的表结果?
In this figure Column 4 contains three sub columns. Is there any way to get the table result like this?
推荐答案
你不能将列分成子列。正如Rohan在评论中所说,这应该在UI层解决。
你应该将结果返回为
Column1 | Column2 | Column3 |子栏目1 |子栏目2 |子栏目3
在DataGrid中你应该应用一个模板来显示子列1 ...子列3作为列4
You can't divide a column into sub columns. As Rohan has said in the comments this should be addressed at the UI layer.
You should return result as
Column1 | Column2 | Column3 | Sub Column 1 | Sub Column 2 | Sub Column 3
and in the DataGrid you should apply a Template to show Sub Column 1 ... Sub Column 3 as Column 4
这篇关于如何在SQL Server中的一个列中选择多个子列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文