Information générale
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
>hiall, i just have this table with the following date that i need to change:
>customer charge date
>01 2201 2004/04/30
>01 2201 2004/04/30
>01 2201 2004/04/30
>01 2202 2004/04/30
>01 2202 2004/04/30
>02 2201 2004/04/30
>02 2201 2004/04/30
>
>customer 01 has 3 charge 2201 then i need to keep the third record with that date, but the previous record i need to discount 30 days, and the previous record another 30 days, in his charge 2202 only discount 30 days to first record, just like the customer 02. This table has 125,226 records
>Any ideas?
>
>Thanks all
Maybe this will help. Assuming that your table is ordered by cust and then charge, this code would change the 1st record by 0 days, the second record by 30 days and the third record by 60 days.
SELECT ThisTable
GOTO TOP
SCAN
save_cust = ThisTable.cust
save_charge = ThisTable.charge
item_cnt = 0
DO WHILE NOT EOF() AND save_cust = ThisTable.cust AND save_charge = ThisTable.charge
REPLACE ThisTable.date WITH (ThisTable.date - (30 * item_cnt))
item_cnt = item_cnt + 1
SKIP
ENDDO
SKIP -1
ENDSCAN
Précédent
Suivant
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement