FORUMS PROFESSIONNELS
WINDEV
,
WEBDEV
et
WINDEV Mobile
Accueil
|
Messages récents
|
Connexion
|
Déconnexion
|
Français
Accueil
→
WINDEV 2024
→
HFSQL query remove duplicate records
HFSQL query remove duplicate records
Débuté par ech madriaga, 12 jan. 2018 22:14 - 5 réponses
Connectez-vous…
ech madriaga
#1
Posté le 12 janvier 2018 - 22:14
Hi All,
How to remove or delete the duplicate records in specific column from HFSQL using query?
Or using codes?
Thanks,
Ech
Signaler
0
0
ech madriaga
#2
Posté le 13 janvier 2018 - 06:32
Any response please.
Thanks,
Ech
Signaler
0
0
GuenterP
#3
Posté le 13 janvier 2018 - 08:12
Hi, all of your problems with queries could be fixed more easily and much faster if you employ a loop through the file and decide which records to delete and which should stay. WINDEV is a programming language offering a load of H-commands which are designed to fulfill the most complex needs in manipulation of datafiles. Queries are just one way of manipulating a HFSQL datafile, there is no guarantee that all of your needs can be covered by the set of available SQL keywords.
The most simple loop:
HReadFirst(YourFile,YourKey)
while not hout(Yourfile)
.
.
Do whatever you need here ...
.
.
HReadNext(YourFile, YourKey)
END
Signaler
0
0
ech madriaga
#4
Posté le 13 janvier 2018 - 08:28
Hi Mit,
Any sample codes to delete the duplicate records in one column.
Thanks,
Signaler
0
0
GuenterP
#5
Posté le 13 janvier 2018 - 09:48
Hi, you store the key of the previous record and if the next record's key is the same then delete it. Where's the problem??
Signaler
0
0
Erik Schwarz
#6
Posté le 13 janvier 2018 - 10:55
Hi Ech,
See what I am doing. The 'Temp...' variables store the values of the current record which I Need to compare for equality. I use a query, just because I filter the data file, don't care about. Next, I never really delete any records in my application, I only mark them as deleted (in German 'Geloescht'). So where I use hmodify you Need to use hdelete.
Hope this helps.
HExecuteQuery(QRY_BuchungStempelDoppelbuchung,hModifyFile,EDT_DatumVon,EDT_DatumBis,EDT_EintragVon,EDT_EintragBis,EDT_AdresseVon,EDT_AdresseBis)
HReadFirst(QRY_BuchungStempelDoppelbuchung)
WHILE NOT HOut
IF nTempOIDMitarbeiter = QRY_BuchungStempelDoppelbuchung.OIDMitarbeiter AND ...
nTempOIDBuchungsart = QRY_BuchungStempelDoppelbuchung.OIDBuchungsart AND ...
nTempAusweisnummer = QRY_BuchungStempelDoppelbuchung.Ausweisnummer AND ...
dtTempZeitpunkt = QRY_BuchungStempelDoppelbuchung.Zeitpunkt AND ...
nTempTerminaladresse = QRY_BuchungStempelDoppelbuchung.Terminaladresse
//
QRY_BuchungStempelDoppelbuchung.Modifiziert = DateSys() + TimeSys()
QRY_BuchungStempelDoppelbuchung.Benutzer = gsBenutzer
QRY_BuchungStempelDoppelbuchung.Geloescht = True
HModify(QRY_BuchungStempelDoppelbuchung)
nAnzahl += 1
STC_Anzahl = "Anzahl: " + nAnzahl
WinRedraw(WIN_DeleteDoppelbuchung)
ELSE
nTempOIDMitarbeiter = QRY_BuchungStempelDoppelbuchung.OIDMitarbeiter
nTempOIDBuchungsart = QRY_BuchungStempelDoppelbuchung.OIDBuchungsart
nTempAusweisnummer = QRY_BuchungStempelDoppelbuchung.Ausweisnummer
dtTempZeitpunkt = QRY_BuchungStempelDoppelbuchung.Zeitpunkt
nTempTerminaladresse = QRY_BuchungStempelDoppelbuchung.Terminaladresse
END
//
HReadNext(QRY_BuchungStempelDoppelbuchung)
END
//
gr
Erik
Signaler
0
0
→ Revenir à WINDEV 2024
WINDEV 2024
WEBDEV 2024
WINDEV Mobile 2024
WINDEV (précédentes versions)
Français
English
Español
Portuguesa
Fermer cette fenêtre
Type de recherche
Uniquement les sujets
Tous les messages
Période de recherche
Date indifférente
Moins d'une heure
Moins de 24 heures
Moins d'une semaine
Moins d'un mois
Moins d'un an
Annuler
Aperçu de votre message
Ajouter une image
Importer une image depuis une URL
Envoyer une image depuis un fichier de votre disque
Déposez ici un fichier ou cliquez sur "Parcourir..."
ou
Annuler
0%
WLangage
SQL
XML, HTML
JAVA, Javascript
Texte