The last InvoiceID, and corresponding fields needs to be selected. The entire sql contains several inner joins.
SELECT max(InvoiceID),
InvoiceEndDate
FROM Invoices
WHERE TransactionOrderItemID = '000831'
Right now, I am getting the InvoiceID, and have to fetch the InvoiceEndDate again.
Is there an efficient way of doing this?