473,396 Members | 2,129 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,396 software developers and data experts.

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 1689
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.********@gmail.comwrote in message
news:11**********************@16g2000cwy.googlegro ups.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.********@gmail.comwrote in message
news:11**********************@16g2000cwy.googlegro ups.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.********@gmail.comwrote in message
news:11**********************@73g2000cwn.googlegro ups.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.********@gmail.comwrote in message
news:11**********************@16g2000cwy.googlegr oups.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.********@gmail.comwrote in message
news:11**********************@73g2000cwn.googlegro ups.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.********@gmail.comwrote in message
news:11**********************@16g2000cwy.googlegro ups.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
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 ...
8
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......
2
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
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...
2
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...
3
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...
6
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 ...
0
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...
9
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,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
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.