My invoice has multiple lines. I read that you can join GeneralJournalEntry but I'm getting many to many with the GeneralJournalAccountEntry table. Can someone help me connect through with multiple invoice lines?
select CustInvoiceTrans.INVOICEID, CustInvoiceTrans.ITEMID, CustInvoiceTrans.LINEAMOUNT, GeneralJournalEntry.RECID as GJERecId , CustInvoiceTrans.RECID as CITRecId from CustInvoiceTrans join CustInvoiceJour on CustInvoiceJour.INVOICEID = CustInvoiceTrans.INVOICEID and CustInvoiceJour.INVOICEDATE = CustInvoiceTrans.INVOICEDATE join GeneralJournalEntry on GeneralJournalEntry.SUBLEDGERVOUCHER = CUSTINVOICEJOUR.LEDGERVOUCHER and GeneralJournalEntry.SUBLEDGERVOUCHERDATAAREAID = CUSTINVOICEJOUR.DATAAREAID where CustInvoiceTrans.INVOICEID = 'SI-CONN-00002536' and CustInvoiceTrans.DATAAREAID = 'conn' select GeneralJournalAccountEntry.GENERALJOURNALENTRY, GeneralJournalAccountEntry.ISCREDIT, GeneralJournalAccountEntry.ACCOUNTINGCURRENCYAMOUNT , GeneralJournalAccountEntry.POSTINGTYPE, GeneralJournalAccountEntry.LEDGERDIMENSION, GeneralJournalAccountEntry.RECID as GJAERecId from GeneralJournalAccountEntry where GeneralJournalAccountEntry.GENERALJOURNALENTRY = '5637845839'