Database Management
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsDatabasesDatabase Management

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old March 4th, 2002, 02:42 PM
jdlux jdlux is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2002
Posts: 4 jdlux User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
merging records

I am trying to combine 2+ records into 1, in the same table with the same id_# but different data in different columns.

Does anyone know how to write a query to do that?
Any help is greatly appreciated.

Last edited by jdlux : March 4th, 2002 at 02:50 PM.

Reply With Quote
  #2  
Old March 5th, 2002, 12:50 AM
andnaess andnaess is offline
Contributing User
Dev Shed Intermediate (1500 - 1999 posts)
 
Join Date: Jul 2001
Location: Oslo
Posts: 1,516 andnaess User rank is Private First Class (20 - 50 Reputation Level)andnaess User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 13
What do you mean by combine? I mean, are they numeric values that you want to sum? Strings you want to concatenate? Videos you want to merge?
__________________
--
Regards
André Nćss

Puritanism: The haunting fear that someone, somewhere may be having fun

Reply With Quote
  #3  
Old March 5th, 2002, 07:09 AM
jdlux jdlux is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2002
Posts: 4 jdlux User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
i mean, i am trying to take te values in one record and put them in another record.

example:

id age ssn
01 022 ----
01 ----- 333-55-2298

given the above, i am trying to have record 1 and 2 combined to
store 1 record.

Last edited by jdlux : March 5th, 2002 at 07:12 AM.

Reply With Quote
  #4  
Old March 5th, 2002, 08:56 AM
andnaess andnaess is offline
Contributing User
Dev Shed Intermediate (1500 - 1999 posts)
 
Join Date: Jul 2001
Location: Oslo
Posts: 1,516 andnaess User rank is Private First Class (20 - 50 Reputation Level)andnaess User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 13
Eh... in your case that's not really possible because you have no unique key from what I can see (the id is 01 in both rows). You'll have to do this by using some sort of script, but what if you have something like:
01, NULL, 'Foo'
01, 'Bar', NULL
01, 'Do', NULL

It's seems to me like you have some seriously screwed data

Reply With Quote
  #5  
Old March 5th, 2002, 09:06 AM
jdlux jdlux is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2002
Posts: 4 jdlux User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
thats just it though, i have no over-lapping data.
the whole table is formatted like this.

ID AGE SS_NUMBER
01 022 -----------------
01 ----- 333-55-2298
02 033 -----------------
02 ----- 444-55-2298
..........
..........
..........
..........
10 044 -----------------
10 ----- 111-22-3344

whoever input'd (not a word is it) this data did it wrong and i have to try 'TRY' and fix it.

Reply With Quote
  #6  
Old March 5th, 2002, 09:29 AM
andnaess andnaess is offline
Contributing User
Dev Shed Intermediate (1500 - 1999 posts)
 
Join Date: Jul 2001
Location: Oslo
Posts: 1,516 andnaess User rank is Private First Class (20 - 50 Reputation Level)andnaess User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 13
Well, then doing it in a script (e.g. PHP) is your only chance. This sort of data shouldn't even be in allowed in a database.

You'll have to extract *all* the records, merge them using the script language, then insert them in a properly designed table.

Reply With Quote
  #7  
Old March 11th, 2002, 02:09 PM
rycamor rycamor is offline
Gödelian monster
Dev Shed Regular (2000 - 2499 posts)
 
Join Date: Jul 1999
Location: Central Florida, USA
Posts: 2,306 rycamor User rank is Sergeant Major (2000 - 5000 Reputation Level)rycamor User rank is Sergeant Major (2000 - 5000 Reputation Level)rycamor User rank is Sergeant Major (2000 - 5000 Reputation Level)rycamor User rank is Sergeant Major (2000 - 5000 Reputation Level)rycamor User rank is Sergeant Major (2000 - 5000 Reputation Level)rycamor User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 3 Days 6 h 42 m 51 sec
Reputation Power: 60
What kind of database are you using? MySQL? PostgreSQL? MSSQL? Others?
__________________
The real n-tier system:

FreeBSD -> PostgreSQL -> [any_language] -> Apache -> Mozilla/XUL

Amazon wishlist -- rycamor (at) gmail.com

Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesDatabase Management > merging records

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap