473,402 Members | 2,050 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,402 software developers and data experts.

Merging Rows with Similar Values

Hello, I've got a question about merging/concatenating rows. There's a similar topic here: Combining Multiple Rows of one Field into One Result but I didn't know if I should hijack it. Basically, I have a single table in Access that looks like:

Name - - - Address - -Email - - - - -Comments
John Doe - 11211 - - - j2@g.com - lad
John Doe - 41541 - - - q3@g.com -asd
John Doe - 12345 - - - w2@g.com -ask

And what I basically want it to look like is:

Name - - - Address - - - Email - - - - - - - - - - - - - - - - - - - - - - - Comments
John Doe - 41541 - - - - j2@g.com, q3@g.com, w2@g.com - - lad, asd, ask

----------------------------

So I've tried this:
SELECT MAX(Table1.Address), MAX(Table1.Name), Max(Table1.Name & Table1.Email) AS emails
FROM Table1;

Similar to the solution given by kyjabber of:
1. SELECT CompanyName, Max(Concat(CompanyName,Product)) AS Products
2. FROM t_CompanyCategoriesProducts
3. GROUP BY CompanyName;

Except with & instead of Concat (because they don't have Concat in Access?), but this only seemed to produce a merging of columns, not rows:

Expr1000 Expr1001 emails
41541 John Doe John Doewqwe22@gmail.com

Which is kinda what I had expected.
Apr 3 '08 #1
6 2110
Scott Price
1,384 Expert 1GB
How do you know that John Doe is one person rather than three people with the same name?

When you answer this, remember that YOU may know, but how does the database know? At this point you have listed three identical names, with different addresses and different email addresses and different comments.

Any solution to your question is going to have to first of all answer this! Otherwise you will have a total mess with your database.

Regards,
Scott
Apr 3 '08 #2
How do you know that John Doe is one person rather than three people with the same name?

When you answer this, remember that YOU may know, but how does the database know? At this point you have listed three identical names, with different addresses and different email addresses and different comments.

Any solution to your question is going to have to first of all answer this! Otherwise you will have a total mess with your database.

Regards,
Scott
Right, I realize this; this is just a small snipplet of our database. I suppose, in order to make it more logical, we would have a personID. So... it'd be something like:

Name - - - Address - -Email - - - - -Comments - - ID
John Doe - 11211 - - - j2@g.com - lad - - - - - - - 1
John Doe - 41541 - - - q3@g.com -asd - - - - - - - 1
John Doe - 12345 - - - w2@g.com -ask - - - - - - - 0



Name - - - Address - - - Email - - - - - - - - - - - - - Comments - - ID
John Doe - 41541 - - - - j2@g.com, q3@g.com- - lad, asd - - - - 1
John Doe - 12345 - - - - w2@g.com - - - - - - - - - - ask - - - - - - - 0
Apr 4 '08 #3
NeoPa
32,556 Expert Mod 16PB
Danny, I appreciate that you have asked this question correctly (no hijack :)), so I will jump in and assist if I can. I should be able to as I was quite heavily involved in the earlier thread.

Now, what I need you to do first is to read through the whole thread, as I believe you will find your explanation of why Concat() will work for you.

It's not a native Access function at all, but one you add to your database as described in the thread. Please post back any questions if there's something you're not sure about.
Apr 4 '08 #4
NeoPa
32,556 Expert Mod 16PB
I should add that you will need to link across to Combining Rows-Opposite of Union (as in kyjabber's thread) to get the information you are looking for.
Apr 4 '08 #5
Ahhh, well that certainly makes more sense... I thought that Code was doing the same thing as the SQL code, but with VB. I got the concat working though! Thanks a lot for that. And... everything looks great! Thanks a bunch guys, I appreciate the help. Curse me for not reading enough, huh? Haha
Apr 4 '08 #6
NeoPa
32,556 Expert Mod 16PB
No worries Danny.

It hardly makes you stand out anyway does it ;)
Apr 4 '08 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

6
by: Jason | last post by:
I need to populate a table from several sources of raw data. For a given security (stock) it is possible to only receive PARTS of information from each of the different sources. It is also...
2
by: Klatuu | last post by:
Whew, I've struggled my way through figuring out how to use XML to transport data..now I can imagine what having a baby is like :) But, I'm stuck now. I generate the XML (single table, no...
5
by: hharry | last post by:
Hello All, I have an issue with dupliate Contact data. Here it is: I have a Contacts table; CREATE TABLE CONTACTS ( SSN int, fname varchar(40),
24
by: Lasse Vågsæther Karlsen | last post by:
I need to merge several sources of values into one stream of values. All of the sources are sorted already and I need to retrieve the values from them all in sorted order. In other words: s1 = ...
0
by: Walt Borders | last post by:
Hi, My problem: Merging two datasets deletes parent elements, preserves all children. I've created two dataSets. Each use the same schema, parent-child nested tables. The first dataSet is...
1
by: mrclash | last post by:
Hello, I have a Database in a SQL Server 2000 where I have different users tables with equal fields like this: id (int) email (varchar) name (varchar) address (varchar) joinedon (datetime)
3
by: Ralph Smith | last post by:
I have two identical databases on two different servers and I need to add the data in tables from one server to the tables in the other server. Is there a way to do that in mysql? thanks, Ralph
2
by: Neil Chambers | last post by:
I am trying to get my head around dataset merging but despite a little research I could still use a pointer (or ten). Basically I want to perform an outer join operation on a dataset (created from...
1
by: akdemirc | last post by:
Hi, My question is about retrieving single records based on a time column, i mean the result set should not include duplicate rows for a unique time value as an example: A B C ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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...
0
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,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
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...
0
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...

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.