first query :
select * from (
select a.beliid, a.Total from Beli a where a.beliid='BL.2111.00627') aa
outer apply
(
select top 1 isnull(alokasi,0) as alok, isnull(materai,0) as mat, isnull(disc,0) as dsc from HutangDtl b where b.Pbl = aa.beliid
) c
second query :
select isnull(alokasi,0) as alok, isnull(materai,0) as mat, isnull(disc,0) as dsc from HutangDtl b where b.pbl='BL.2112.00627'
result from alok, mat and dsc not the same with first query
Attachments:
You must be
logged in to view attached files.