select b.deliveryStartDate, b.bidName, b.bidNumber, b.bidOpeningDateTime, bl.bidLineQtyAmt, bl.bidLineQtyUM, blp.awardedStatus, blp.awardedSubClassifier, blp.awardedPrice, blp.awardedComments,
blp.priceDeliveredRate, blp.priceFobRate, blp.priceOffInvoiceRate, blp.priceBillBackRate, blp.commodityAllowanceRate, blp.commodityNetRate, blp.commodityPassThroughRate,
blp.awardedBidDstId, blp.awardedBidDstId2, blp.noAwardMFR, blp.noAwardSKU, blp.noAwardPack, blp.noAwardCompMFR
from tbl_BID_Bids b
inner join tbl_BID_BidLines bl
on b.ownerId = bl.ownerId
and b.ownerType = bl.ownerType
and b.bidId = bl.bidId
inner join tbl_BID_BidLineProducts blp
on bl.ownerId = blp.ownerId
and bl.ownerType = blp.ownerType
and bl.bidLineId = blp.bidLineId
where blp.ownerId = 387
and blp.ownerType = 'BRO'
and b.bidAgencyId = 2009
and b.bidId <> 25115
order by b.deliveryStartDate desc
select * from qmd_historicBid