select b.sourceBidId, bl.sourceBidLineId, blp.sourceBidLineProductId from tbl_BID_Bids b left join tbl_BID_BidLines bl on b.bidId = bl.bidId left join tbl_BID_BidLineProducts blp on bl.bidLineId = blp.bidLineId where b.ownerId = and b.ownerType = and b.bidId = and bl.bidLineId = and blp.bidLineProductId = select b.bidId, bl.bidLineId, blp.bidLineProductId, b.sourceBidId, bl.sourceBidLineId, blp.sourceBidLineProductId, b.bidName, b.bidNumber, b.bidOpeningDateTime, blp.awardedStatus, blp.awardedComments, blp.awardedBidDstId, blp.priceDeliveredRate, blp.priceFobRate, blp.priceOffInvoiceRate from tbl_BID_Bids b left join tbl_BID_BidLines bl on b.bidId = bl.bidId left join tbl_BID_BidLineProducts blp on bl.bidLineId = blp.bidLineId where b.ownerId = and b.ownerType = and blp.bidLineProductId in ( ) order by b.bidId desc