且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在SQL Server中的一个列中选择多个子列

更新时间:2023-01-20 18:49:48

你不能将列分成子列。正如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