outer apply query result not valid - wrong data

  • 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.
  • i type wrong id

  • aman wrote:

    i type wrong id

    Yes, 'BL.2112.00627' isn't the same as 'BL.2111.00627', so not surprising that you may get different results from the two queries. 🙂

     

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply