select acl.Person_ID as 'รหัส'
,pnr.FullName_TH as 'ชื่อ'
,case acl.persontype when 'sap' then 'บุคคลทั่วไป' end as 'ประเภท'
From tbl_aculog acl left join tbl_PerNR pnr On acl.Person_ID=pnr.Person_ID
union
select acl.Person_ID as 'รหัส'
,ps.FullName_TH as 'ชื่อ'
,case acl.persontype when 'nonsap' then 'บุคคลอื่นๆ' end as 'ประเภท'
From tbl_aculog acl left join tbl_Person ps On acl.Person_ID=ps.NPerson_ID
select acl.Person_ID as 'รหัส'
,pnr.FullName_TH as 'ชื่อ'
,case acl.persontype when 'sap' then 'บุคคลทั่วไป' end as 'ประเภท'
From tbl_aculog acl left join tbl_PerNR pnr On acl.Person_ID=pnr.Person_ID
union
select acl.Person_ID as 'รหัส'
,ps.FullName_TH as 'ชื่อ'
,case acl.persontype when 'nonsap' then 'บุคคลอื่นๆ' end as 'ประเภท'
From tbl_aculog acl left join tbl_Person ps On acl.Person_ID=ps.NPerson_ID
เป็น
Code (ASP)
select acl.Person_ID as 'รหัส'
,pnr.FullName_TH as 'ชื่อ'
,case acl.persontype when 'sap' then 'บุคคลทั่วไป' end as 'ประเภท'
From tbl_aculog acl left join tbl_PerNR pnr On acl.Person_ID=pnr.Person_ID
union
select acl.Person_ID as 'รหัส'
,ps.FullName_TH as 'ชื่อ'
,case acl.persontype when 'nonsap' then 'บุคคลอื่นๆ' end as 'ประเภท'
From tbl_aculog acl left join tbl_Person ps On acl.Person_ID=ps.NPerson_ID
GROUP BY Person_ID, FullName_TH