轉置

摘要:轉置

方法一:selef join

  SELECT A.RESOURCE_ID,A.RESOURCE_NAME,A.RESOURCE_STATUS, 
             B.RESOURCE_DESCRIPTION_VALUE as DbType, 
             C.RESOURCE_DESCRIPTION_VALUE as DbCd, 
             D.RESOURCE_DESCRIPTION_VALUE as TableCd, 
             E.RESOURCE_DESCRIPTION_ID yddResourceDescriptionId,E.RESOURCE_DESCRIPTION_VALUE as TableNm             
             FROM YDD_RESOURCE A  
             LEFT JOIN YDD_RESOURCE_DESCRIPTION B ON (B.RESOURCE_ID = A.RESOURCE_ID and B.RESOURCE_TYPE_PROPERTY='DbType') 
             LEFT JOIN YDD_RESOURCE_DESCRIPTION C ON (C.RESOURCE_ID = A.RESOURCE_ID and C.RESOURCE_TYPE_PROPERTY='DbCd') 
             LEFT JOIN YDD_RESOURCE_DESCRIPTION D ON (D.RESOURCE_ID = A.RESOURCE_ID and D.RESOURCE_TYPE_PROPERTY='TableCd') 
             LEFT JOIN YDD_RESOURCE_DESCRIPTION E ON (E.RESOURCE_ID = A.RESOURCE_ID and E.RESOURCE_TYPE_PROPERTY='TableNm') 
             WHERE A.RESOURCE_TYPE_ID = 6;