Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SQL Needed To Update Records
Message
 
General information
Forum:
Visual FoxPro
Category:
Object Oriented Programming
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows XP
Network:
Windows XP
Database:
Visual FoxPro
Application:
Desktop
Miscellaneous
Thread ID:
01566306
Message ID:
01566370
Views:
32
>>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
Previous
Reply
Map
View

Click here to load this message in the networking platform