PC SOFT

FOROS PROFESIONALES
WINDEVWEBDEV y WINDEV Mobile

Inicio → WINDEV 2024 → Find Duplicates in a file
Find Duplicates in a file
Iniciado por guest, 18,feb. 2016 01:12 - 6 respuestas
Publicado el 18,febrero 2016 - 01:12
Hello All,

Is there a way with a query to find records with duplicates. Something like if you have a filed name find all records with more then 1 that are the same.

DW
Publicado el 18,febrero 2016 - 01:50
Hello DW

If it is a one off request then WDMap can do easily, otherwise you will need to code a solution.
I found this youtube video with a simple example that might work for you



Regards
Al
Publicado el 18,febrero 2016 - 02:54
Hi DW
If all you want is to find the duplicate records something like the following works.
SELECT * FROM LOCATION WHERE LocationId NOT IN (SELECT MIN(LocationID) FROM LOCATION GROUP BY POSTCODE,DESCRIPTION,LATITUDE,LONGITUDE) If you're not using HFSQL you can probably use basically the same query to delete them, however HFSQL doesn't seem to allow sub-queries with DELETE.
I had to put the records in a table & then delete from there.

David
Publicado el 18,febrero 2016 - 10:53
SELECT dup_field, count(*) FROM filename
GROUP BY dup_field
HAVING COUNT(*) > 1
Publicado el 20,febrero 2016 - 00:11
Hello All,

Thank you I used Al's you tube video link and got it to work in the query editor.

SELECT COUNT(JOB_INFO.PO) AS Count_1, JOB_INFO.PO AS PO FROM JOB_INFO GROUP BY JOB_INFO.PO HAVING COUNT(JOB_INFO.PO) > 1
Publicado el 20,febrero 2016 - 16:23
Hi
easily done in wlanguage

if hreadseek(file, name, search on) then

// do this to be certain that at least 1 item exists
For all file where file.name = name

do something with the result
End

End
Publicado el 20,febrero 2016 - 22:46
Hello Allard,

I don't think so,

You would have to loop thru all the records in the db that way. to see if to had the same value.

The query pulls only the records that have more then 1 with the same value.

DW