拿欄位資料直接查詢別張表並轉出對應

摘要:拿欄位資料直接查詢別張表並轉出對應

SELECT TimesId ,ParliamentName ,ParliamentSequence ,  
ParliamentType = 
(
   select CodeValue 
   from SystemCode 
   where Code = ParliamentType and CodeIndex= 'PType'
) 
,StartDate ,EndDate ,UseStatus, AssignDate ,CreatedUserId ,CreatedUserName ,CreatedDate
,ModifiedUserId ,ModifiedUserName ,ModifiedDate
FROM COMTimes
 
這樣查詢 ParliamentType 會被取代成子查詢結果。