I have created a pivot table that transforms my data. Very basic UNPIVOT SQL Code:
SELECT ProjectID, Element, GBP FROM
( SELECT ProjectID, FacilitatingWorks,
Toxichazardouscontaminatedmaterialremoval,
Majordemolitionworks,
Specialistgroundworks,
Temporarydiversionworks,
Extraordinarysiteinvestigationworks,
Substructure,
Superstructure,
Frame,
Upperfloors,
Roof,
Stairsandramps,
Externalwalls,
Windowsandexternaldoors,
Internalwallsandpartitions,
Internaldoors,
Internalfinishes,
Wallfinishes,
Floorfinishes,
Ceilingfinishes,
Fittingsfurnishingsandequipment,
Services,
Sanitaryinstallations,
Servicesequipment,
Disposalinstallations,
Waterinstallations,
Heatsource,
Spaceheatingandairconditioning,
Ventilation,
Electricalinstallations,
Fuelinstallations,
Liftandconveyorinstallations,
Fireandlighteningprotection,
Communicationsecurityandcontrolsystems,
Specialistinstallations,
Buildersworkinconnectionwithservices,
Prefabricatedbuildingsandbuildingunits,
Worktoexistingbuildings,
Minordemolitionworksandalterationworks,
Repairstoexistingservices,
Dampproofcoursesfungusandbeetleeradication,
Facaderetention,
Cleaningexistingsurfaces,
Renovationworks,
Externalworks,
Sitepreparationworks,
Roadspathspavingsandsurfaces,
Softlandscapingplantingandirrigationsystems,
Fencingrailingsandwalls,
Externalfixtures,
Externaldrainage,
Externalservices,
Minorbuildingworksandancillarybuildings,
Maincontractorspreliminaries,
Maincontractorsoverheadsandprofit,
Projectdesignteamfees,
Otherdevelopmentprojectcosts,
RiskAllowance,
InflationAllowance,
CostTotal
FROM dbo.Cost) BasicBenchmark
UNPIVOT
(GBP FOR Element IN (FacilitatingWorks,
Toxichazardouscontaminatedmaterialremoval,
Majordemolitionworks,
Specialistgroundworks,
Temporarydiversionworks,
Extraordinarysiteinvestigationworks,
Substructure,
Superstructure,
Frame,
Upperfloors,
Roof,
Stairsandramps,
Externalwalls,
Windowsandexternaldoors,
Internalwallsandpartitions,
Internaldoors,
Internalfinishes,
Wallfinishes,
Floorfinishes,
Ceilingfinishes,
Fittingsfurnishingsandequipment,
Services,
Sanitaryinstallations,
Servicesequipment,
Disposalinstallations,
Waterinstallations,
Heatsource,
Spaceheatingandairconditioning,
Ventilation,
Electricalinstallations,
Fuelinstallations,
Liftandconveyorinstallations,
Fireandlighteningprotection,
Communicationsecurityandcontrolsystems,
Specialistinstallations,
Buildersworkinconnectionwithservices,
Prefabricatedbuildingsandbuildingunits,
Worktoexistingbuildings,
Minordemolitionworksandalterationworks,
Repairstoexistingservices,
Dampproofcoursesfungusandbeetleeradication,
Facaderetention,
Cleaningexistingsurfaces,
Renovationworks,
Externalworks,
Sitepreparationworks,
Roadspathspavingsandsurfaces,
Softlandscapingplantingandirrigationsystems,
Fencingrailingsandwalls,
Externalfixtures,
Externaldrainage,
Externalservices,
Minorbuildingworksandancillarybuildings,
Maincontractorspreliminaries,
Maincontractorsoverheadsandprofit,
Projectdesignteamfees,
Otherdevelopmentprojectcosts,
RiskAllowance,
InflationAllowance,
CostTotal)) AS UNPIVT_VALUES
WHERE ProjectID = {{table1.selectedRow.data.ProjectID}}
This UNPIVOT table creates the following table:
I now want to run adjustments to this data without editing the data in the databse. So I created a TempTable with this code:
This however, renders the following table:
Clearly not what I need. The table just has to be identical to the table originally created with the UNPIVOT query but a Temp Table and not one that, if I edit, will change the data in the database.
Any help welcome