Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Set relationship
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows 7
Network:
Windows 2008 Server
Database:
MS SQL Server
Application:
Desktop
Miscellaneous
Thread ID:
01593576
Message ID:
01593595
Views:
43
>>>>>>>Hello
>>>>>>>I have three table with a common field. Can I set the relation between these three tables and their common field? I am used to doing
>>>>>>>this with 2 but not 3. Is there some way I can establish a "relationship" between 12 tables, each of which has a common field.
>>>>>>
>>>>>>I find using SQL and cursors much easier than anything involving SET RELATION, SET SKIP etc. I haven't used the latter commands for many years.
>>>>>
>>>>>I still use them to verify in first step visually if I generated large amounts of data - second step is generating descriptive stats across linked tables. Often you see your gotchas in the browse relationships test without having to wait for heavy join action ;-)
>>>>
>>>>I have 12 tables, actually more, and each one has a common field, called mDate, in this format: 201211281730, which includes the year, the month, the day, the hour, and the
>>>>minute (in 15 minute segments). In addition, each table has a numeric field, called mRating. What I really want to do is to get the sum of all of the mRating's fields, for each particular
>>>>hour. I really am not sure how to do this with sql. The following must be a step in the wrong direction and will take a really, really long time.
>>>>
>>>>
>>>>SELECT table1.mRating + table2.mRating as SumRating FROM table1, table2
>>>>
>>>>
>>>>Is there a better quicker way to do this with SQL? I know I can use set relation with 2 tables. But the help in VFP 9 does not say much about additive, although I
>>>>suppose it must be what it sounds like.
>>>>
>>>>Thanks, Steve
>>>
>>>
>>>CLOSE ALL
>>>SELECT 1
>>>USE table4
>>>INDEX on mindex TO g
>>>SELECT 2
>>>USE table5
>>>INDEX on mindex TO gg
>>>SELECT 3
>>>USE table6
>>>INDEX on mindex TO ggg
>>>SELECT 4
>>>USE table7
>>>INDEX on mindex TO gggg
>>>SELECT 5
>>>USE table8
>>>INDEX on mindex TO o
>>>SELECT 6
>>>USE table9
>>>INDEX on mindex TO oo
>>>
>>>SELECT 1
>>>SET RELATION TO mindex INTO table5 additive
>>>SET RELATION TO mindex INTO table6 additive
>>>SET RELATION TO mindex INTO table7 additive
>>>SET RELATION TO mindex INTO table9 additive
>>>SET RELATION TO mindex INTO table10 additive  && after 4 set relation's, foxpro says the following: Table10 is not found
>>>
>>
>>
>>> && after 4 set relation's, foxpro says the following: Table10 is not found
>>
>>Yeah, but I don't see where you opened it
>
>Thank you for catching that!

Having set the relations with 2 or more tables, is there a way to copy the results to another table. Ideally, the output would look like this, but with
just two tables showing:
mDate                table1.mRating  table2.mRating   SumRatings
201211281745    1.5                     2.3                          3.8
Thank you,
Steve
Previous
Reply
Map
View

Click here to load this message in the networking platform