Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
callmejabba
Starting Member
4 Posts |
Posted - 2005-07-12 : 15:26:54
|
| I am a newbie. I have to write a query that brings back an product_number (which is unique) and its corresponding action_code. Problem is that a product_number and have multiple action_codes so the results will come back something like this:Product_nbr action_codeA20191 DECA20191 FROA20191 PPIs there a way so I can get out the redundant product_nbr's and have it display something like this:Product_nbr action_code1 action_code2A20191 DEC FRO |
|
|
clarkbaker1964
Constraint Violating Yak Guru
428 Posts |
Posted - 2005-07-12 : 16:36:34
|
if you dont have to many you could use a case statement.select distinct product_nbr, case action_code when 'DEC' then action_code as action_code1, case action_code when 'FRO' then action_code as action_code2,If You have many action_codes this can become ugly. You can do anything at www.zombo.com |
 |
|
|
callmejabba
Starting Member
4 Posts |
Posted - 2005-07-13 : 10:01:38
|
| There are a possibility of 80 action codes, so I guess I may be going at this the wrong way :(No product as more than 3-5 but each product could be any of those 80 |
 |
|
|
|
|
|