Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Helping Normalizing This Table

Status
Not open for further replies.

PeasNCarrots

Programmer
Jun 22, 2004
73
US
How would I do this via a query or code..

Normalize this table..

Center_SLIC July04_SA July04_Freq Aug04_SA Aug04_Freq
0140 1.88% 53.11 1.91% 52.23
0150 3.22% 34.2 2.12% 33.23
0160 2.12% 47.2 2.21% 45.3
0170 1.58% 63.34 1.72% 58.04

TO

SLIC Date SA Freq
 
I would suggest against using the field name Date, it is a reserved word in many SQL language syntaxes.
 
I know about the date field, I am more concered with normalizing the inital table.
 
I just wrote out a description, but Tek-tips 404'd me so I'll look at getting to it again in a bit.
 
PeasNCarrots,

How many rows are we talking about? I can give you some help doing it in Excel via a PivotTable and some formulas.

Skip,

Want to get great answers to your Tek-Tips questions? Have a look at faq222-2244
 
Quick description to normalize:
Take your Center_SLIC and bring them into their own table. Make each Center_SLIC to have some primary key ID. Then make a new table with a field for the SLIC, Date, SA, and FREQ. Then run an INSERT statement pulling the SLIC, SA, and FREQ from the original table, as well as specifying the DATE for the fields you are pulling from, and insert it into the new table.
Code:
[b]tbl_SLIC[/b]
SLIC_ID (PKEY)
SLIC_Other (Anything else per SLIC)

[b]tbl_SLIC_Data[/b]
SLIC_ID (FKEY)
RepDate (Date)
SA (Decimal, Formatted)
FREQ (Decimal, Formatted)
Primary Key (SLIC_ID, RepDate)

Now you can just input your data into the tbl_SLIC_Data table using some SELECT statements. These are close but not quite. Just change the date and the column values to coincide with the data you are impoting.
Code:
INSERT INTO tbl_SLIC_Data
VALUES (SELECT Center_SLIC, #04/01/2004#, July04_SA, July04_Freq)

When complete, you should have a table of SLIC info and a table of SLIC dates and data. Level 1 normalization.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top