如何使用存储过程在 XML SQL 中使用 distinct

how to using distinct in XML SQL using stored procedure

SELECT DISTINCT
    CD.CASE_NO AS CaseNumber , 
    CE.PROCEEDING_ID AS ProceedingId, 
    PR.AC_STATE_CD AS ForeclosureStatecode, 
    0 AS STATUS, 
    GETDATE() AS CreatedDate, 
    1 AS CreatedBy, 
    GETDATE() AS ModifiedDate, 
    1 AS ModifiedBy,
            (
            select * from TBL_PROPERTY FOR XML PATH('T')
            )
            from TBL_CASE_DETAIL CD WITH(NOLOCK)
                    INNER JOIN TBL_AUCTION_DETAIL AD WITH(NOLOCK) ON AD.CASE_DETAIL_ID = CD.CASE_DETAIL_ID
                    LEFT JOIN TBL_AUCTION_PROPERTY_MAPPING TAPM WITH(NOLOCK) ON TAPM.AUCTION_ID = AD.AUCTION_ID
                    LEFT JOIN TBL_PROPERTY PR WITH(NOLOCK) ON PR.PROPERTY_ID = TAPM.PROPERTY_ID
                    LEFT JOIN TBL_AUCTION_PROCEEDING_MAPPING APM WITH(NOLOCK) ON APM.AUCTION_ID = AD.AUCTION_ID

    FOR XML PATH('Foreclosure')

大家好,这是我修改后的代码以获得不同的结果。但是现在 属性 部分无法正常显示..

这是我得到的结果。假设为 属性 打开另一个选项卡假设有 3 属性.. 所以在止赎的 1 个选项卡中,止赎内有 3 属性 数据,然后关闭止赎选项卡..
https://gyazo.com/8a54690c88df3e9bb0dd7ff916c6f86c 谢谢你。

如果我没猜错,你唯一需要补充的就是 ,TYPE。否则你的内部 SELECT ... FOR XML PATH() 将被填充为所有禁止字符转义的文本...

尝试:

(
    select * from TBL_PROPERTY FOR XML PATH('T'),TYPE
)