Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
SQL Needed To Update Records
Message
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Programmation Orientée Object
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Windows XP
Network:
Windows XP
Database:
Visual FoxPro
Application:
Desktop
Divers
Thread ID:
01566306
Message ID:
01566370
Vues:
34
>>Thanks a lot. It worked. However I tried the same SQl on another similar code, but it didn't worked. Please Guide Again
>>
>>
>>Select Subledger
>>Go Top
>>Scan While .Not. Eof()
>>If Left(Vrno,2)=="J-"
>>Alldata_Vrno=Vrno
>>Select Journal
>>Locate For Vrno==Alldata_Vrno
>>If Found()=.T.
>>SumNaration=Naration1+Naration2+Naration3+Naration4+Naration5
>>Endif
>>Select Subledger
>>Replace Details With SumNaration
>>Endif
>>ENDSCAN
>>
>>
>
>update SubLedger
>set Details = J.Naration1 + J.Naration2 + J.Naration3 + J.Naration4 + J.Naration5
>from SubLedger INNER JOIN Journal J ON SubLedger.Vrno = J.Vrno
>WHERE SubLedger.Vrno LIKE 'J-%'
BTW, in your original code what is supposed to happen when the match is not found? It looks like it was updating the details with previous row matching data. I think that was most likely a mistake, that's why I used inner join. If there is no match, no update will be done.
If it's not broken, fix it until it is.


My Blog
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform