473,569 Members | 2,762 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Combining multiple records into one based on a key field -- inside one table !

I'm really scratching my head over this one. I'm working with CSV data exported
from Excel, which explains why it's a mess to begin with.

Within a table (or via any other means someone might be able to recommend) I
need to combine multiple records which share two like fields. (If that's not
clear, the real-world explanation is below.)

+----------+--------------+----+----+----+----+----+
| ID | ADDRESS | P1 | P2 | P3 | P4 | P5 |
+----------+--------------+----+----+----+----+----+
| COMP1 | 123 Main St | 1 | | | | |
| COMP1 | 123 Main St | | 1 | | | |
| COMP1 | 123 Main St | | | 1 | | |
| COMP2 | 45 Oak Pl | 1 | | | | |
| COMP2 | 45 Oak Pl | | | 1 | | |
| COMP2 | 45 Oak Pl | | | | 1 | |
| COMP2 | 45 Oak Pl | | | | | 1 |
+----------+--------------+----+----+----+----+----+

Must be distilled to :

+----------+--------------+----+----+----+----+----+
| ID | ADDRESS | P1 | P2 | P3 | P4 | P5 |
+----------+--------------+----+----+----+----+----+
| COMP1 | 123 Main St | 1 | 1 | 1 | | |
| COMP2 | 45 Oak Pl | 1 | | 1 | 1 | 1 |
+----------+--------------+----+----+----+----+----+

So essentially I want to combine all of the 'Px' fields for each ID into one
record.

The real model : The data represents companies (identified by ID) and the
product lines they stock (P1 - P5). Right now, there's a separate rec for each
product line. I need to combine those seperate recs into one.
_______________ _____

I suppose I could import the raw data into separate tables, each with one 'P'
field -- and then combine them into another, but I'm not sure about that
approach either.
_______________ _____

I already tried to make Excel combine before exporting, but had no luck.

Any help will be _greatly_ appreciated. I'm stumped.

Jul 20 '05 #1
0 1647

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
992
by: glenn | last post by:
I'm really scratching my head over this one. I'm working with CSV data exported from Excel, which explains why it's a mess to begin with. Within a table (or via any other means someone might be able to recommend) I need to combine multiple records which share two like fields. (If that's not clear, the real-world explanation is below.) ...
6
2634
by: Christopher Harrison | last post by:
Is there a way to store an indefinite number of keys in one field and self join them? Imagine, for example, you have a table of users with a "friends" column. Say user 1 is friends with users 9, 7, 24 and 6; then would it be possible to store this array/list/whatever-you-want-to-call-it into user 1's friends cell and extract the join in a...
1
2158
by: Heather | last post by:
I know this is a painful question and I have searched the group for past responses and none of the responses seem to cover my specific need. We have a table that contains fields like ID, Yr, DateOfTest, TestSource, TestScore, TestSubScore1, TestSubScore2, etc An individual can have taken this test once or nth amount of times. There are...
11
4508
by: dskillingstad | last post by:
I've been struggling with this problem for some time and have tried multiple solutions with no luck. Let me start with, I'm a novice at Access and I'm not looking for someones help to design my database,just help in getting me pointed in the right direction. I have a database with 8 tables, which from what I have read, cannot be linked...
2
3395
by: Will | last post by:
I have a table, tblManinstructions with fields Code & InstructionID, one Code can have many InstructionID. I also have tblinstructions (fields instructionID & instruction). What I want to do is create a table with the fields Code and Instruction - a combination of all instructions from the instruction IDs in tblManinstructions). E.g. Code...
4
2087
by: Robert Bravery | last post by:
Hi all, I have now correctly set up my dataset and two grids, so that the parent navigates the child. THe thing is that the child table is actually a lookup type table. It lists billing types for the parent table, so that I just store a key in the parent table, and the show the billing type description from the child I need to set this up in...
16
3469
by: Ian Davies | last post by:
Hello Needing help with a suitable solution. I have extracted records into a table under three columns 'category', 'comment' and share (the category column also holds the index no of the record in a hidden field) I wish the user to be able to edit the data in the table, so I have extracted the records into hiddenfield, textareas, dropdown...
52
6277
by: MP | last post by:
Hi trying to begin to learn database using vb6, ado/adox, mdb format, sql (not using access...just mdb format via ado) i need to group the values of multiple fields - get their possible variations(combination of fields), - then act on each group in some way ...eg ProcessRs (oRs as RecordSet)... the following query will get me the...
2
2589
by: rdraider | last post by:
Using SQL 2000, how can you combine multiple records into 1? The source data is varchar(255), the destination will be text. I need help with the select statement. example tables: CREATE TABLE ( , , (255), ,
0
7694
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7609
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7921
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7964
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6278
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5504
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3651
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
2107
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
936
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.