>>>>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..............:)