 |
|
Code (SQL)
select * from [VER]
LEFT JOIN [SalesInvHd]
ON replace(substring([VER].[Source RowId : Field3],12,19),'-','') = replace([SalesInvHd].[No_],'-','')
LEFT JOIN [SalesInvLn]
ON (replace(substring([VER].[Source RowId : Field3],12,19),'-','') = replace([SalesInvLn].[Document No_],'-','')
AND replace(substring([VER].[Source RowId : Field6],12,19),'-','') = replace([SalesInvLn].[Line No_],'-',''))
ปล. พยายามหลีกเลี่ยงการใช้ * ให้ใช้ (sleect docno,name .... ) แทน มันจะทำให้ช้า
และลดการ join (ถ้าไม่จำเป็น)
* การจะใช้ substring ต้องรู้ตำแหน่งที่แน่นอนด้วยนะจ๊ะ 
|
 |
 |
 |
 |
Date :
2016-01-15 15:04:35 |
By :
ipstarone |
|
 |
 |
 |
 |
|
|
 |