sql、oracle資料多行轉單行

dyh12345678發表於2018-10-19

sql 查詢多行轉單行資料,並且用逗號分隔展示方法

 string uersid = db.DLookup("substring((SELECT ',' + cast(id as varchar(36))", "tb_users", "type = '黨委學員'  FOR XML PATH,TYPE).value('.', 'varchar(max)'),2,100000)");

ORACLE 查詢多行轉單行資料,並且用逗號分隔展示方法

    string ZWGW = db.DLookup("wmsys.wm_concat (DISTINCT to_char(SUBSTR(PRGW,1,2))) as ZWGW", "T_RYDD", "GZRWBH=:GZRWBH", new OracleParameter(":GZRWBH", ViewState["GZRWBH"]));

 

相關文章