当前位置 : 主页 > 网络编程 > net编程 >

sql server group by 拼接

来源:互联网 收集:自由互联 发布时间:2023-10-08
select g.GameItem,g.UserId,b.vipLevel, CAST(( SELECT a.orderId+',' FROM G_Game_Order a WHERE g.userId=a.userId and SettleTime='2023-09-25 00:00:00' and SettleTime='2023-09-25 23:59:59' and XmState=0 and status=1 FOR XML PATH('')) as varchar

select g.GameItem,g.UserId,b.vipLevel,

CAST((

    SELECT  a.orderId+',' FROM G_Game_Order a

    WHERE  g.userId=a.userId and  SettleTime>='2023-09-25 00:00:00' and SettleTime<='2023-09-25 23:59:59' and XmState=0 and status=1  

    FOR XML PATH('')) as varchar(max)) as maskdetail  

 

from G_Game_Order as g ,C_User_Register as b  


where g.UserId= b.UserId and  SettleTime>='2023-09-25 00:00:00' and SettleTime<='2023-09-25 23:59:59' and XmState=0 and status=1

group by g.GameItem,g.UserId,b.vipLevel


上一篇:c#泛型委托
下一篇:没有了
网友评论