 |
|
ต้องการ join หลายตาราง โดยเก็บค่า null และให้แสดงค่าไม่ซ้ำกัน |
|
 |
|
|
 |
 |
|
ให้ลองเพิ่ม
Code (ASP)
GROUP BY Person_ID, FullName_TH
จาก
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
เป็น
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
จะได้ค่าที่ไม่ซ้ำครับ

|
 |
 |
 |
 |
Date :
2012-09-11 00:19:45 |
By :
jeerawat |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ขอบคุณมากคะ ได้แล้วววว >_<
|
 |
 |
 |
 |
Date :
2012-09-13 14:24:26 |
By :
porn_toon |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|