Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Update table from other table
Message
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Versions des environnements
Visual FoxPro:
VFP 9 SP2
Network:
Windows XP
Database:
Visual FoxPro
Application:
Desktop
Divers
Thread ID:
01480441
Message ID:
01480449
Vues:
35
>>>
>>>I have two tables: 
>>>exam has fields : code,obt01.
>>>hwsv has fields:code, perc
>>>e.g
>>>
>>>code         perc
>>>1              100
>>>2              89
>>>3             70
>>>.....
>>>i want to update exam field  obt01 with  hwsv filed is perc.
>>>
>>>like this.
>>>
>>>if  perc is 100  replace exam field with 10
>>>
>>>
>>>if  perc is 80  to 99  replace exam field with 9
>>>if  perc is 70 to 89  replace exam field with 8
>>>............
>>>
>>
>>Something like
>>
>>update Exam ;
>>set Obt01 = ceiling((Perc+0.9)/10) from Exam inner join Hwsv Hv ;
>>on Exam.Code = Hv.Code
>replaced all records with 1
>need more help

Start with the select first - verify that select produces right data. Then turn SELECT into update.
If it's not broken, fix it until it is.


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

Click here to load this message in the networking platform