You haven't said what was actually correct, 1 or 4 lines for that invoice? The InvoiceLine shows a row for every line in a invoice, so if a invoice had 4 lines, I would get 4 rows. I checked to see if my results were valid by running both:-
select txnid, txnnumber, refnumber, ponumber, InvoiceLineDesc from InvoiceLine where ponumber is not null
and
select txnid, txnnumber, refnumber, ponumber, InvoiceLineDesc from InvoiceLine unoptimized where ponumber is not null
and I found that the data rows returned matched the actually invoices in QuickBooks.
You can fully resync your optimized InvoiceLine table by running:-
sp_optimizefullsync InvoiceLine |