First off, I cannot change the structure of the tables or their fields.I have the following 4 tables and the below is the current query I am working withtvwr_ContractInvoices---------------------------InvoiceNumber INTContractNumber INTtblContractDetail---------------------------ContractNumber INTItemID VARCHARYearlyPrice FLOATtblPriceLevels---------------------------PriceLevelsKeyID INTDescription VARCHARtblPriceLevelOverride---------------------------PriceLevelOverrideKeyID INTFkPriceLevels INTFlatPrice FLOAT
SELECTInvoiceNumber,c.ContractNumber,c.ItemID,YearlyPrice,FkPriceLevels,Description,FlatPriceFROM tvwr_ContractInvoices i, tblContractDetail c, tblPriceLevelOverride po, tblPriceLevels pWHERE i.ContractNumber = c.ContractNumber AND c.ItemID = po.ItemID AND po.FkPriceLevels = p.PriceLevelsKeyID AND i.InvoiceNumber = 31GROUP BYInvoiceNumber,c.ContractNumber,c.ItemID,YearlyPrice,FkPriceLevels,Description,FlatPrice
With a query like that I get results like:Inv# Con# ItemID Yr Price Price Level PL Desc Flat Price31 51 Item1 249.99 18 Price Level 18 219.9931 51 Item1 249.99 19 Price Level 19 199.9931 51 Item1 249.99 20 Price Level 20 189.9931 51 Item1 249.99 21 Price Level 21 159.99
But what I want is something like:Inv# Con# ItemID Yr Price PL 18 Price PL 19 Price PL 20 Price PL 21 Price31 51 Item1 249.99 219.99 199.99 189.99 159.99
Is this possible within the limitations I have to work? I am able to create views but I cannot modify any existing tables or views.ThanksJustin Bezansonwww.aspnetguy.com