J
John Thomas
The following 2 LINQ statements give me my desired results but would like to
do it all in the 1st only a Left Outer Join, so I'm not returning unneeded
data.
The desired results are Invoices where IsPaid is false OR IsPaid is true but
payments are applied to them, which is what second statment filters for.
Dim invAll = (From c In db.ARIentries _
Where c.CustomerID = cusID _
Group Join i In db.ARIPayments On i.InvoiceID Equals
c.KeyID _
Into Payment = Group _
From i In Payment.DefaultIfEmpty _
Select c.InvoiceDate, c.InvoiceNumber, c.Amount,
c.Balance, c.KeyID, c.IsPaid, i.Payment).ToArray
Dim inv = (From i In invAll _
Where i.IsPaid = False Or i.Payment > 0 _
Select i).ToArray
Thanks John
do it all in the 1st only a Left Outer Join, so I'm not returning unneeded
data.
The desired results are Invoices where IsPaid is false OR IsPaid is true but
payments are applied to them, which is what second statment filters for.
Dim invAll = (From c In db.ARIentries _
Where c.CustomerID = cusID _
Group Join i In db.ARIPayments On i.InvoiceID Equals
c.KeyID _
Into Payment = Group _
From i In Payment.DefaultIfEmpty _
Select c.InvoiceDate, c.InvoiceNumber, c.Amount,
c.Balance, c.KeyID, c.IsPaid, i.Payment).ToArray
Dim inv = (From i In invAll _
Where i.IsPaid = False Or i.Payment > 0 _
Select i).ToArray
Thanks John