Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SQL JOIN to Update
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
01113543
Message ID:
01113548
Views:
15
:o))
UPDATE Temp3 SET ClientName = ALLTRIM(Client.ClientId) + " - " + Client.Cl_Name
       WHERE Temp3.ClientId = Client.ClientId

** or
UPDATE Temp3 SET ClientName = ALLTRIM(Client.ClientId) + " - " + Client.Cl_Name
       FROM Temp3 INNERT JOIN Client ON Temp3.ClientId = Client.ClientId

** or if you want all fields in table3 to be updated, no metter if there are macthing records in Client (i doubt about it)
UPDATE Temp3 SET ClientName = NVL(ALLTRIM(Client.ClientId) + " - " + Client.Cl_Name, '')
       FROM Temp3 LEFT JOIN Client ON Temp3.ClientId = Client.ClientId
>I'm using VFP9.
>
>Corrected:
>
>
>SELECT Temp3
>SCAN
>				
>    =SEEK(Temp3.ClientId, "Client", "ClientId")
>
>    REPLACE IN Temp3 ;
>       ClientName WITH ALLTRIM(Client.ClientId) + " - " + Client.Cl_Name
>       NEXT 1
>
>END SCAN
>
>
>
>>>How can I use a JOIN to update instead of:
>>>
>>>
>>>SELECT Temp3
>>>SCAN
>>>				
>>>    **=SEEK(TempJoin.ClientId, "Client", "ClientId")
>>>    =SEEK(Temp3ClientId, "Client", "ClientId")
>>>
>>>    REPLACE IN Temp3 ;
>>>       ClientName WITH ALLTRIM(Client.ClientId) + " - " + Client.Cl_Name
>>>       NEXT 1
>>>
>>>END SCAN
>>>
>>
>>Hey, from where TempJoin comes from?
>>BTW what version of VFP you use?
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform