Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Updating Tables issue 1

Status
Not open for further replies.

porthos2222

Programmer
Feb 8, 2013
2
NL
Hello everybody. First post here, although I am a long time reader.

I am not a programmer per se in Visual Fox Pro (using version 7 and 9 depending on the computer I use here at work, possibly upgrading all PCs to VFP 9 in the near future), but I did a lot of programming in VB 6.0

I have two tables,

Table "References" structure
field "distance"(double 8,3) (This field is the distance of the road)
field "repair"(char 15)
This table has 1000 records (for example)

Table "Compare" structure
field "distance"(numeric 8,3) (This field is the distance of the road)
field "repair" (char 15)

Table "Compare" has 15 records (for example). Some of those 15 records match the distances values (or so, error less than 0.1 decimal side) in table "References"

I need to update the table "References" field "repair" with all "repair" values from "Compare" that match the "Compare" field "distance".

Something like this I supposed that it will work in VFP9

Update References ;
Set repair = Compair.repair ;
From Compair ;
Where Compair.Distance = References.Distance


But it is not working. How would you perform this?

Thank you!

Porthos








 
If the distance as you say has a difference (error less than 0.1 decimal side), why do you expect "Where Compair.Distance = References.Distance" to work? you'd need a match by a condition accepting a certain distance. Where ABS(Compair.Distance - References.Distance) < 0.1 for example.

Bye, Olaf.
 
Oh, and of course you're welcome, but you'll know that anyway.

I hope this helps.

Bye, Olaf.
 
Thank you Olaf! I was about to include the tolerance, I forgot about it! In my case it will be <0.01.

Have a nice day!

Porthos
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top