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