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.

 All Forums
 Other Forums
 MS Access
 Consolidate entries with multiple data

Author  Topic 

antman28
Starting Member

10 Posts

Posted - 2009-04-29 : 16:12:14
How can I take entries with multiple attributes, and run a query to combine them into a single entry with the attributes separated by line breaks.

Lets say I have...

ID Attribute
1 red
1 blue
2 green
2 blue
2 white
3 blue

I want it to display as

ID Attribute
1 red
blue
2 green
blue
white
3 blue

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2009-04-29 : 16:13:12
That's a presentation issue and should be handled in your application and not in SQL.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog

"Let's begin with the premise that everything you've done up until this point is wrong."
Go to Top of Page

antman28
Starting Member

10 Posts

Posted - 2009-04-29 : 16:52:00
Actually, this is a table coming from 2 different groups. Each group entered the data differently. One handleded multiple attributes for a particular item within the same record. The other group created a new record for each attribute an item had. I am trying to combine these tables in MS Access via a query to create one clean table.
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2009-04-29 : 16:54:06
You're going to need to provide a better example as what you just described does not match your original post.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog

"Let's begin with the premise that everything you've done up until this point is wrong."
Go to Top of Page

antman28
Starting Member

10 Posts

Posted - 2009-04-29 : 17:00:44
The 2 scenarios in the original post can be the examples. The 1st layout shows how the data is entered in one of the tables (a separate row for each attribute). The 2nd layout shows how the data uis handled for the other table (a single row for each ID, with multiple attributes separated by a line break within the cell). Basically, I need to merge the tables so that the data is displayed in the same manner. I thought running a query to create a new table would be the easiest way, but am open to other options.
Go to Top of Page

antman28
Starting Member

10 Posts

Posted - 2009-04-30 : 12:18:50
It would be easiest if I could just run a query that would capture the data I store it the way I need so that I can export that table.
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2009-04-30 : 13:15:45
Moving this topic to the MS Access forum.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog

"Let's begin with the premise that everything you've done up until this point is wrong."
Go to Top of Page
   

- Advertisement -