TP Underground Lounge 07/08
-


Hinweise


Antwort
 
LinkBack Themen-Optionen Thema durchsuchen Thema bewerten
Alt 10.03.2004, 13:52   #1
TP-Veteran
 
Benutzerbild von Flow09
 
Registriert seit: Jun 2001
Ort: Wien
Flow09 ist auf einem guten Weg

Doppelte Datensätze entfernen


Hey,

ich hab in einer PostgreSQL-DB eine Tabelle mit Postleitzahlen und Gemeindenamen (ca. 20.000 Datensätze)! Leider sind viele davon doppelt (z.B. 10 × 7000, Eisenstadt) !!

Ich möchte jetzt alle überflüssigen Datensätze entfernen! Sprich die alle Datensätze wo mehrmals PLZ und Ortsname ident sind?

Keine Ahnung wie ich das anfangen soll?

lg
Flow
__________________
Lesser known Programming Languages #13: SLOBOL
... Although many compilers allow you to take a coffee break while they compile, SLOBOL compilers allow you to travel to Bolivia to pick the coffee. Forty-three programmers are known to have died of boredom sitting at their terminals while waiting for a SLOBOL program to compile. Weary SLOBOL programmers often turn to a related (but infinitely faster) language, COCAINE.
Flow09 ist offline   Mit Zitat antworten


Alt 10.03.2004, 14:04   #2
TP-Specialist
 
Registriert seit: Aug 2002
Ort: Nähe Wien
prefix ist auf einem guten Weg
hi flo

don stuck hat mir da mal geholfen - ausschnitt aus dem thread:

PHP-Code:
$q mysql_query("SELECT count(*) AS anzahl, orgnr, vmnr  FROM fdaw_vmdaten GROUP BY orgnr, vmnr HAVING anzahl > 1"); 
ganzer thread (2. seite beinhaltet das)
prefix ist offline   Mit Zitat antworten
Alt 10.03.2004, 14:30   #3
TP-Senior
 
Benutzerbild von CharlyB
 
Registriert seit: May 2002
Ort: DD
CharlyB ist auf einem guten Weg
Entfernt nicht das kleine Schlüsselwörtchen "distinct" alle doppelten Ergebnisse der Anfrage!?

(select distinct * from ... )
__________________
school-fellows.net << jetzt noch besser, da Testaccount

Blog
CharlyB ist offline   Mit Zitat antworten
Alt 10.03.2004, 14:31   #4
TP-Specialist
 
Registriert seit: Aug 2002
Ort: Nähe Wien
prefix ist auf einem guten Weg
es ENTFERNT nicht, sondern es WÄHLT nur einen datensatz aus
prefix ist offline   Mit Zitat antworten
Alt 10.03.2004, 14:33   #5
TP-Specialist
 
Benutzerbild von mike
 
Registriert seit: Jan 2002
Ort: TP/Dynamik
mike bringt sich richtig ein
denke, das is eine einmalige sache.

wenn ja, dann probier es mit einer Hilfs-tabelle, die du dann via insert into select distinct * from quelltabelle
füllst.

Alte tabelle dann löschen und mit der aktuellen weiterarbeiten.
__________________
Gehelft? Hier kannst du dich bedanken.

mike
mike ist offline   Mit Zitat antworten
Alt 10.03.2004, 14:37   #6
TP-Senior
 
Benutzerbild von CharlyB
 
Registriert seit: May 2002
Ort: DD
CharlyB ist auf einem guten Weg
ohhja - diesen kleinen feinheiten ...
__________________
school-fellows.net << jetzt noch besser, da Testaccount

Blog
CharlyB ist offline   Mit Zitat antworten
Alt 11.03.2004, 16:34   #7
TP-Veteran
 
Benutzerbild von Flow09
 
Registriert seit: Jun 2001
Ort: Wien
Flow09 ist auf einem guten Weg
Danke für die Tipps!

Inzwischen hat sich die Situation (bzw. der Inhalt der Tabellen) geändert! Is also nicht mehr nötig!

lg
Flow
__________________
Lesser known Programming Languages #13: SLOBOL
... Although many compilers allow you to take a coffee break while they compile, SLOBOL compilers allow you to travel to Bolivia to pick the coffee. Forty-three programmers are known to have died of boredom sitting at their terminals while waiting for a SLOBOL program to compile. Weary SLOBOL programmers often turn to a related (but infinitely faster) language, COCAINE.
Flow09 ist offline   Mit Zitat antworten
Alt 25.10.2005, 17:34   #8
TP-Veteran
 
Benutzerbild von Flow09
 
Registriert seit: Jun 2001
Ort: Wien
Flow09 ist auf einem guten Weg
Hey,

jetzt muss ich das Thema nochmal aufgreifen! Hab das gleiche Problem schon wieder! Das Select-Query funktioniert, aber wie verpack ich das in ein DELETE???


lg
Flow
__________________
Lesser known Programming Languages #13: SLOBOL
... Although many compilers allow you to take a coffee break while they compile, SLOBOL compilers allow you to travel to Bolivia to pick the coffee. Forty-three programmers are known to have died of boredom sitting at their terminals while waiting for a SLOBOL program to compile. Weary SLOBOL programmers often turn to a related (but infinitely faster) language, COCAINE.
Flow09 ist offline   Mit Zitat antworten
Alt 25.10.2005, 18:25   #9
TP-Special Mod
 
Benutzerbild von steffenk
 
Registriert seit: Feb 2005
Ort: Haan / NRW
steffenk lebt für das TP und seine Usersteffenk lebt für das TP und seine Usersteffenk lebt für das TP und seine Usersteffenk lebt für das TP und seine Usersteffenk lebt für das TP und seine Usersteffenk lebt für das TP und seine Usersteffenk lebt für das TP und seine Usersteffenk lebt für das TP und seine User
wie mike schon sagte - mit select distinct in ein Array auslesen, dann mit truncate leeren und mit Insert into wieder befüllen.
__________________

Typo3 · MySQLDumper · dislabs
·
manche Mühlen mahlen schneller ...
"Ich habe Rücken"
Horst Schlämmer
steffenk ist offline   Mit Zitat antworten
Antwort

  Aktuelles Thema
  TP Hilfe Forum > Web-Editoren & Coding > Traum-Dynamik
Doppelte Datensätze entfernen Doppelte Datensätze entfernen
« $_GET Ausgabe eines “ <input type='radio' … “ | Frage zu navigation »

Aktive Benutzer in diesem Thema: 1 (Registrierte Benutzer: 0, Gäste: 1)
 
Themen-Optionen Thema durchsuchen
Thema durchsuchen:

Erweiterte Suche
Thema bewerten
Thema bewerten:

Forumregeln
Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are an
Gehe zu


Alle Zeitangaben in WEZ +2. Es ist jetzt 11:15 Uhr.

Powered by: vBulletin Version 3.7 (Deutsch)
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd. / Search Engine Friendly URLs by vBSEO 3.2.0 ©2008, Crawlability, Inc.
Traum-Projekt.com | Suchen | Archiv | Impressum | Kontakt | | | Nach oben |



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67