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

Create table query 1

Status
Not open for further replies.

puppet

IS-IT--Management
Dec 13, 2001
140
I have a table with the following format:

Item Code_Type Code
---------------------
1 ABC H
1 DEF Q
1 GHI 20
25 ABC Y
25 DEF D
25 HGI 30
30 ABC L
30 DEF Q
30 GHI 25
30 GHI 45

And I want to create a flat table with the following format...

Item ABC DEF GHI
-------------------------
1 H Q 20
25 Y D 30
30 L Q 25
30 L Q 35

This would be simple if the Code_Type could only contain one value but at least one of the code types will sometimes (not always) contain multiple values - eg Code_Type GHI above has a value of 25 and 35. The actual data is different this was just an easier way to explain it.

I get table 1 from a dts package every morning and need to setup a job to create table 2 from table 1. I'm sure there must be an easy way to do this but I am still learning SQL and do not know how to do it.

Any ideas appreciated.
 
>>Warning: Null value eliminated from aggregate

Don't worry about it in this situation.
 
"Warning: Null value eliminated from aggregate" is an ANSI warning indicating that null values were ignored when using an aggregate function such as MIN, MAX, SUM, etc.

This is explained in SQL BOL.

Terry L. Broadbent - DBA
Computing Links:
faq183-874 contains "Suggestions for Getting Quick and Appropriate Answers" to your questions.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top