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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Update Query - Normalization Help

Status
Not open for further replies.

niteraven

Technical User
Joined
Oct 26, 2006
Messages
92
Location
US
Hello All

I am trying to figure a way to normalize the data in a database that a person is currently using. The database has one table with all of the contact information and processes that each contact. All data was entered in the table, and when a contact had another process, he added it to the same row ( not a new record ). SO i have split out the Contact info and the processes, and that is all good. Except all of the processes were marked with a text letter X. I ran a update query and changed it all to a checkbox, he wanted checkboxes. I think it would be better to use a combobox with list of processes to choose from.
My question is: Is there a way to take all 20 processes (that are currently each a field) and make them into one field thru a query?

I want to carry the current information into the new database with no extra data entry. So i need to get 20 fields into one field. If that makes sense. If you can point me in the right direction or to a good book on how to accomplish this it would be greatly appreciated



Thanks in advance
Raven
 
I think you are looking for a union query:


SELECT "Proc1" As ProcName, Proc1 As Proc FROM t
UNION ALL
SELECT "Proc2" As ProcName, Proc2 As Proc FROM t
<...>
UNION ALL
SELECT "Proc20" As ProcName, Proc20 As Proc FROM t
 
a normalization query:
Code:
SELECT "Field1" as OrginalName, Field1 As Value FROM TableName where Field1 <> ''
UNION
SELECT "Field2", Field2 FROM TableName where Field2 <> ''
UNION
SELECT "Field3", Field3 FROM TableName where Field3 <> ''

Will give a result set of:
[tt]
OriginalName Value
Field1 SomeValue
Field1 ADifferentValue
Field2 SomeThing
Field2 AnotherThing
Field3 Widget
Field3 Fidget
[/tt]

Leslie

Have you met Hardy Heron?
 
I should add, you can then use the union query to either create a new table or to update an existing one.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top