Hi,
I have this table named Tstandard and contain several fields(ie.. Item, onhand etc)
I have a few records duplicated under the field Item wich is a character field, the problem i have is that i have not found a Select sql command tta filter the duplicated record cause under field "Item" i could have :
Fields
Item onhand
99935 4
99936 3
99937-245 6
11011-233 15
11011-233 1
11011-245 20
11011-245 1
ok so when i run an sql i am getting as duplicated 999935, 99936 and 99937-245, these are not duplicated but cause starting the 3 digits are the same, then are shown as duplicated, actually what i need is to browse the table and show these type of dupliactes
11011-233 15
11011-233 1
11011-245 20
11011-245 1
so then the one i need to delete are the one that are having under the field onhand<=2 so i wrote this code and i am able to mark for deletion some of the real duplicated but also are others duplicated records that are not marked for deletion where the onhand should be <=2, here is the code i have, of course i need to do this under an old foxpro dos version 2.0, but i wrote the code under VFP 5.0
USE tstandard excl
INDEX on item +STR(onhand)TAG it
SET ORDER TO it
GO top
DO WHILE !EOF() && Begins loop
STORE item TO n
SKIP
STORE item TO n_1
IF EOF( )
EXIT
ENDIF
IF n#n_1
SKIP
LOOP
ENDIF
SKIP -1
DELETE
SKIP 2
ENDDO && Ends loop
BROWSE
USE
retu
*** what could be wrong ? or it is there any sql code, that can point me to something like this but always showing the table in order to delete the duplicates i want ?
Thanks
Ernesto
I have this table named Tstandard and contain several fields(ie.. Item, onhand etc)
I have a few records duplicated under the field Item wich is a character field, the problem i have is that i have not found a Select sql command tta filter the duplicated record cause under field "Item" i could have :
Fields
Item onhand
99935 4
99936 3
99937-245 6
11011-233 15
11011-233 1
11011-245 20
11011-245 1
ok so when i run an sql i am getting as duplicated 999935, 99936 and 99937-245, these are not duplicated but cause starting the 3 digits are the same, then are shown as duplicated, actually what i need is to browse the table and show these type of dupliactes
11011-233 15
11011-233 1
11011-245 20
11011-245 1
so then the one i need to delete are the one that are having under the field onhand<=2 so i wrote this code and i am able to mark for deletion some of the real duplicated but also are others duplicated records that are not marked for deletion where the onhand should be <=2, here is the code i have, of course i need to do this under an old foxpro dos version 2.0, but i wrote the code under VFP 5.0
USE tstandard excl
INDEX on item +STR(onhand)TAG it
SET ORDER TO it
GO top
DO WHILE !EOF() && Begins loop
STORE item TO n
SKIP
STORE item TO n_1
IF EOF( )
EXIT
ENDIF
IF n#n_1
SKIP
LOOP
ENDIF
SKIP -1
DELETE
SKIP 2
ENDDO && Ends loop
BROWSE
USE
retu
*** what could be wrong ? or it is there any sql code, that can point me to something like this but always showing the table in order to delete the duplicates i want ?
Thanks
Ernesto