hypetech
hypetech

Reputation: 166

Normalizing Database to 1NF

Does anyone have code/ideas for changing a table formatted like

Bldg____Meter1___Meter2___Meter3
Bldg1___1________2________3_____
Bldg2___4________5________6_____

to

Bldg____Meter
Bldg1___1____
Bldg1___2____
Bldg1___3____
Bldg2___4____
Bldg2___5____
Bldg2___6____

This is normalizing to 1NF right?

Also anyway to do this through VBA or SQL is fine, just looking for any ideas.

Upvotes: 1

Views: 104

Answers (1)

Heinzi
Heinzi

Reputation: 172270

INSERT INTO newTab (Bldg, Meter) SELECT Bldg, Meter1 FROM oldTab
INSERT INTO newTab (Bldg, Meter) SELECT Bldg, Meter2 FROM oldTab
INSERT INTO newTab (Bldg, Meter) SELECT Bldg, Meter3 FROM oldTab

Upvotes: 1

Related Questions