Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How do you SET RELATION in a SELECT statement?
Message
From
02/11/2000 14:29:15
 
 
To
02/11/2000 14:13:09
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00437238
Message ID:
00437278
Views:
21
>>>>Working in VFP60... I want to get a result query that is based on a
>>>>SET RELATION. The common fields are part_number.
>>>>My result query should have the following information.
>>>>
>>>>Common Part number........parts_sold _in_1999.....parts_sold_in_2000
>>>>102.....................................230.............................400
>>>>
>>>>Any Ideas?
>>>
>>>What is the relation?
>>----
>>table1 - partno
>>table2 - partno
>>the relationship is partno...:)
>
>OK - assuming table1 is 1999 sales and table2 is 2000 sales
>and the field that tells you is "sales"
>
>e.g., assuming only 1 record per part in each (WHERE clause is optional)
>
lnPartNo = 102
>SELECT t1.part_no, ;
>  t1.sales AS parts_sold_in_1999, ;
>  t2.sales AS parts_sold_in_2000 ;
>  FROM table1 t1 JOIN table2 t2 ON t1.part_no = t2.part_no ;
>  WHERE table1.part_no = lnPartNo ;
>  INTO CURSOR cuPartSales
>
>if there are more than one sale for each part in each table,
>
SELECT t1.part_no, ;
>  SUM(t1.sales) AS parts_sold_in_1999, ;
>  SUM(t2.sales) AS parts_sold_in_2000 ;
>  FROM table1 t1 JOIN table2 t2 ON t1.part_no = t2.part_no ;
>  WHERE table1.part_no = lnPartNo ;
>  GROUP BY t1.part_no ;
>  INTO CURSOR cuPartSales
------------
Hi Trey and thanks..............:)
Robert Keith
Independent Developer
San Antonio, Texas
E-mail address:
rebelrob1@yahoo.com
Previous
Reply
Map
View

Click here to load this message in the networking platform