Wednesday, March 28, 2012

normalize a table with 3 similar columns (was "Plz help out")

Hi,I am working on SQL Server.
I have a table with columns that need to be broken down. I nees to break this table:

TelNo1 TelNo2 TelNo3

555-44-33 555-43-88 555-46-89

into:

Tel_Number

555-44-33
555-43-88
555-46-89

I tried using the union statement but i just did'nt succed. Can anyone help me,pleaseIt helps if you post the statements where you didn't "succeed". But anyway:
SELECT TelNo1
FROM theTable
UNION
SELECT TelNo2
FROM theTable
UNION
SELECT TelNo3
FROM theTable

No comments:

Post a Comment