473,785 Members | 3,417 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Transposing duplicate rows to new columns

Hi there,

I have a large table based around a CustomerNumber with various details
about that customer (originally imported and augmented from an Exchange
Server)...now, a single customer can have many email addresses and thus
will have multiple entries in this table but this isn't what I want. Is
there a way to relatively simply take any duplicate CustomerNumber
records, take their EmailAddress field and append it in a new column
(EmailAddressN as applicable)? I wasn't sure whether some sort of
Crosstab query had some advanced functionality making this a
possibility.

Any help is greatly appreciated as I'm sure someone would have come
past this problem before!

Thanks,
-Mal

Dec 5 '06 #1
4 1707
Yes it is possible, but I do not think that you should do that, it violates
the principles of a relational database and will cause you many unnecessary
difficulties down the line.

I recommend that you put the email address in a new table with the customer
number as the key. A simple make table query will do that.

"m.wanstall " <m.********@gma il.comwrote in message
news:11******** **************@ 16g2000cwy.goog legroups.com...
Hi there,

I have a large table based around a CustomerNumber with various details
about that customer (originally imported and augmented from an Exchange
Server)...now, a single customer can have many email addresses and thus
will have multiple entries in this table but this isn't what I want. Is
there a way to relatively simply take any duplicate CustomerNumber
records, take their EmailAddress field and append it in a new column
(EmailAddressN as applicable)? I wasn't sure whether some sort of
Crosstab query had some advanced functionality making this a
possibility.

Any help is greatly appreciated as I'm sure someone would have come
past this problem before!

Thanks,
-Mal


Dec 6 '06 #2
Thanks David,

Sorry I should have said, I realise normalization of the data would be
the ideal solution BUT this is imported directly from an Exchange
server which is updated VERY regularly so I was hoping to cut down on
the amount of data separation since that is part of the problem with
the current system. I realise normalization and proper relationships is
the ideal solution however I am working in a less than ideal
environment and this database is piggybacking on a fair few dynamic and
unintuitive systems thus why I shy away from any further normalization.

Despite the trade off, could you possibly explain how I could do this
transposition via a query?

Many thanks,
-Mal

David F Cox wrote:
Yes it is possible, but I do not think that you should do that, it violates
the principles of a relational database and will cause you many unnecessary
difficulties down the line.

I recommend that you put the email address in a new table with the customer
number as the key. A simple make table query will do that.

"m.wanstall " <m.********@gma il.comwrote in message
news:11******** **************@ 16g2000cwy.goog legroups.com...
Hi there,

I have a large table based around a CustomerNumber with various details
about that customer (originally imported and augmented from an Exchange
Server)...now, a single customer can have many email addresses and thus
will have multiple entries in this table but this isn't what I want. Is
there a way to relatively simply take any duplicate CustomerNumber
records, take their EmailAddress field and append it in a new column
(EmailAddressN as applicable)? I wasn't sure whether some sort of
Crosstab query had some advanced functionality making this a
possibility.

Any help is greatly appreciated as I'm sure someone would have come
past this problem before!

Thanks,
-Mal
Dec 6 '06 #3
The universe is a "less than ideal" environment, and it is people sitting in
your seat making your decisions that help keep it so. I have been there and
done that, and feel sorry for all of those that have had to clear up my
mess. I do not think I will be doing you, or anyone following you, any
favours if I get you through the poison ivy into the haunted forest. Sorry.

I really think that you should do the work now to save the work later and
automate the process of getting data into the database in proper fashion. I
would love to help with that, but I really do not have the time at present.

"If you are going through hell ...
.... keep going." Sir Winston Churchill

"m.wanstall " <m.********@gma il.comwrote in message
news:11******** **************@ 73g2000cwn.goog legroups.com...
Thanks David,

Sorry I should have said, I realise normalization of the data would be
the ideal solution BUT this is imported directly from an Exchange
server which is updated VERY regularly so I was hoping to cut down on
the amount of data separation since that is part of the problem with
the current system. I realise normalization and proper relationships is
the ideal solution however I am working in a less than ideal
environment and this database is piggybacking on a fair few dynamic and
unintuitive systems thus why I shy away from any further normalization.

Despite the trade off, could you possibly explain how I could do this
transposition via a query?

Many thanks,
-Mal

David F Cox wrote:
>Yes it is possible, but I do not think that you should do that, it
violates
the principles of a relational database and will cause you many
unnecessary
difficulties down the line.

I recommend that you put the email address in a new table with the
customer
number as the key. A simple make table query will do that.

"m.wanstall " <m.********@gma il.comwrote in message
news:11******* *************** @16g2000cwy.goo glegroups.com.. .
Hi there,

I have a large table based around a CustomerNumber with various details
about that customer (originally imported and augmented from an Exchange
Server)...now, a single customer can have many email addresses and thus
will have multiple entries in this table but this isn't what I want. Is
there a way to relatively simply take any duplicate CustomerNumber
records, take their EmailAddress field and append it in a new column
(EmailAddressN as applicable)? I wasn't sure whether some sort of
Crosstab query had some advanced functionality making this a
possibility.

Any help is greatly appreciated as I'm sure someone would have come
past this problem before!

Thanks,
-Mal



Dec 6 '06 #4
Fair call David and I understand where you're coming from. The most
pressing factor in my position, as you would know, is time (or lack
there of). Whilst I would sleep better at night if I could do this the
"right" way, it may simply be a matter of time. However thanks for your
opinion I do certainly understand your point of view, I know 90% of my
job is fixing up the legacy mess others left me and it would seem
counter productive for me to keep the wheel turning...but therein lies
one of the things I have grown to severely dislike about multinational
enterprise systems.

I'll see if I can help us both sleep a little better or at least try to
find some middle ground.
David F Cox wrote:
The universe is a "less than ideal" environment, and it is people sitting in
your seat making your decisions that help keep it so. I have been there and
done that, and feel sorry for all of those that have had to clear up my
mess. I do not think I will be doing you, or anyone following you, any
favours if I get you through the poison ivy into the haunted forest. Sorry.

I really think that you should do the work now to save the work later and
automate the process of getting data into the database in proper fashion. I
would love to help with that, but I really do not have the time at present.

"If you are going through hell ...
... keep going." Sir Winston Churchill

"m.wanstall " <m.********@gma il.comwrote in message
news:11******** **************@ 73g2000cwn.goog legroups.com...
Thanks David,

Sorry I should have said, I realise normalization of the data would be
the ideal solution BUT this is imported directly from an Exchange
server which is updated VERY regularly so I was hoping to cut down on
the amount of data separation since that is part of the problem with
the current system. I realise normalization and proper relationships is
the ideal solution however I am working in a less than ideal
environment and this database is piggybacking on a fair few dynamic and
unintuitive systems thus why I shy away from any further normalization.

Despite the trade off, could you possibly explain how I could do this
transposition via a query?

Many thanks,
-Mal

David F Cox wrote:
Yes it is possible, but I do not think that you should do that, it
violates
the principles of a relational database and will cause you many
unnecessary
difficulties down the line.

I recommend that you put the email address in a new table with the
customer
number as the key. A simple make table query will do that.

"m.wanstall " <m.********@gma il.comwrote in message
news:11******** **************@ 16g2000cwy.goog legroups.com...
Hi there,

I have a large table based around a CustomerNumber with various details
about that customer (originally imported and augmented from an Exchange
Server)...now, a single customer can have many email addresses and thus
will have multiple entries in this table but this isn't what I want. Is
there a way to relatively simply take any duplicate CustomerNumber
records, take their EmailAddress field and append it in a new column
(EmailAddressN as applicable)? I wasn't sure whether some sort of
Crosstab query had some advanced functionality making this a
possibility.

Any help is greatly appreciated as I'm sure someone would have come
past this problem before!

Thanks,
-Mal
Dec 7 '06 #5

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

Similar topics

2
4724
by: Fabio | last post by:
Hello, is there any quite easy solution for the problem of transposing the rows into the columns? I have the following table with some data in it: dealer date 09.00 10.00 11.00 12.00 13.00 14.00 ----------------------------------------------------------------- 1 2004-10-01 1/1 2/3 3/3 3/4 4/5 0/3 1 2004-10-02 0/1 1/3 1/3 1/4 3/5 1/3
8
2866
by: Leszek Gruszka | last post by:
Hello! I need to transpose some columns into rows and rows into columns. I know, tha i can do it by cursor, but i don't know how make it... I read a lot about it, but still don't understand... Can someone help me? *** Sent via Developersdex http://www.developersdex.com ***
2
1871
by: agekay | last post by:
Hi there, I would like to know how to get rows with duplicate values in certain columns. Let's say I have a table called "Songs" with the following columns: artist album title genre
2
3070
by: g_chime | last post by:
I'm sorry, I had a couple of typos in my original post. Here is the corrected version: How can I make MySQL reject duplicate rows when inserting? The table is quite large: 100+ columns and millions of rows. MySQL doesn't allow me to create a UNIQUE INDEX for all the columns (16 columns is the max.)
2
6265
by: Howard William | last post by:
Help. I am a bit flummoxed by the problem of how to transpose "normalized" (in the database sense) data records into columns of for a data entry form, and then back again when the user is finished. My previous solution to this was to filter by query or SQL for the observations for a particular set of criteria, then go through the resulting records and assign them to a non-normalized work table containing ONE RECORD with the rows x...
3
4590
by: dan graziano | last post by:
Hi, How do you suggest is the best way to check for duplicate rows in an access table. And once one knows if there are duplicates, to remove all but one. In my access table, there are 5 field columns. The first 4 columns are descriptor fields. The 5th column is a value. You know there are duplicate rows when the contents of the first four
6
13764
by: Bob Stearns | last post by:
I am getting duplicate rows back from a select distinct statement of the form: SELECT DISTINCT 'jhough', '000111', t0.bhid FROM (SELECT lots of good stuff) t0 LEFT OUTER JOIN another_table t1 ON relevant_stuff WHERE (lots of conditions) After re-reading the relevant pat ofVol 1 of the SQL Reference I am unablee to see how this is possible.
0
2107
by: B.N.Prabhu | last post by:
Hi, I have a DataTable with several rows. Its having 20 Columns. when i click the Insert button then i have to check the Database Rows. Whether these new rows are already available in the Database. If its there, then i need to seperate the Duplicate Records Based upon 4 columns(EmployeeID, ProjectName, ProjectType, StartTime -- should be activate as a Composite Primary key)
9
10668
by: Classic-Car-World Ltd | last post by:
Hi, I have some data in a table in columns which I need to convert into rows. This is specification data for some tools etc. The data is currently in the following format: Product No, order, description, value 1000, 1, model No, Ak272 1000, 2, Size, 10mm 1000, 3, Length, 20mm 1001, 1, Model No, Ak273
0
9643
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 usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10147
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10085
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9947
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 choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8968
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 launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5379
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 the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4045
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
2
3645
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2877
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 effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.