zoukankan      html  css  js  c++  java
  • 【原】SQL Server get csv group by

    DECLARE  @Table1 TABLE(EntityID INT, AttributeID INT, OptionText VARCHAR(50))
    INSERT INTO @Table1
    SELECT  503048'M'

    INSERT INTO @Table1
    SELECT  503048'F'

    --Begin actual working SQL          
    SELECT      T1.EntityID,
                T1.AttributeID,
                STUFF(( SELECT    '' + T2.OptionText
                        FROM      @Table1 T2
                        WHERE     T2.AttributeID = T1.AttributeID
                        AND       T2.EntityID = T1.EntityID
                        FOR XML PATH('')
                      ), 12''[Attributes]
    FROM        @Table1 T1
    GROUP BY    T1.EntityID, T1.AttributeID
  • 相关阅读:
    bzoj4289
    bzoj3033
    bzoj3144
    896C
    bzoj4430
    bzoj4455
    bzoj5117
    BZOJ 1564: [NOI2009]二叉查找树
    BZOJ1261: [SCOI2006]zh_tree
    BZOJ1090: [SCOI2003]字符串折叠
  • 原文地址:https://www.cnblogs.com/luckylei66/p/2588847.html
Copyright © 2011-2022 走看看