select batchId from tbl_EAI_inboundBatches b where b.ownerId = 1984 and b.ownerType = 'MFR' and b.fileFormat = '$InvoiceHistory' and exists ( select * from tbl_IMPORT_InvoiceHistory where eai_batchId = batchId ) and status = 'OK' and message = 'Step 1 - Initialized Import Table' order by batchId