select * from tbl_BID_BidLineProducts blp inner join tbl_BID_BidLines bl on blp.bidLineId = bl.bidLineId where blp.ownerId = and blp.ownerType = and bl.bidId = insert into tbl_BID_BidLineProductDistributors values ( , , , 18153, 'N' ) select blpd.bidLineProductId from tbl_BID_BidLines bl inner join tbl_BID_BidLineProducts blp on blp.bidLineId = bl.bidLineId and blp.ownerId = and blp.ownerType = inner join tbl_BID_BidLineProductDistributors blpd on blpd.bidLineProductId = blp.bidLineProductId and blpd.ownerId = and blpd.ownerType = where bl.bidId = and bl.ownerId = and bl.ownerType = and blp.bidLineProductStatus = 'A' and blpd.quoteStatus = 'N' update tbl_BID_Bids set bidStatus = where bidId = and ownerId = and ownerType =