t****n 发帖数: 10724 | 1 用GROUP BY 时有没有string的function
当datatype是数时,可以用sum,max,min,average etc. 但似乎没有string的,还是
只能用cursor。
CourseName Comment
English Met
English Need more practice on writing
English Conference with parents
Math Met
Math Excellent
GROUP BY CourseName
想得到的结果是
CourseName Comment
English Met,Need more practice on writing,conference with parents
Math Met,Excellent
|
J********t 发帖数: 83 | 2 you can use XML PATH() to contenate records from one column in multiple
rows.
here is an example almost identical to your question:
http://forums.asp.net/t/1258217.aspx |
c****7 发帖数: 366 | 3 Listagg
★ 发自iPhone App: ChineseWeb 7.7
【在 t****n 的大作中提到】![](/moin_static193/solenoid/img/up.png) : 用GROUP BY 时有没有string的function : 当datatype是数时,可以用sum,max,min,average etc. 但似乎没有string的,还是 : 只能用cursor。 : CourseName Comment : English Met : English Need more practice on writing : English Conference with parents : Math Met : Math Excellent : GROUP BY CourseName
|
t****n 发帖数: 10724 | 4 sql server 只能用STUFF - PATH, 是目前最好的方法,只是没有象oracle一样一个
LISTAPP简洁明了。
【在 J********t 的大作中提到】![](/moin_static193/solenoid/img/up.png) : you can use XML PATH() to contenate records from one column in multiple : rows. : here is an example almost identical to your question: : http://forums.asp.net/t/1258217.aspx
|