|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Create a Highly Available Database Solution. Advantage Database Server can provide the availability to keep your data safe and ready for your application and users. |
|
#1
|
|||
|
|||
|
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. |
|
#2
|
|||
|
|||
|
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 |
|
#3
|
|||
|
|||
|
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. |
|
#4
|
|||
|
|||
|
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 ![]() |
|
#5
|
|||
|
|||
|
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. |
|
#6
|
|||
|
|||
|
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. |
|
#7
|
|||
|
|||
|
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 |
![]() |
| Viewing: Dev Shed Forums > Databases > Database Management > merging records |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|