Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
A question on how to link to another table using SELECT?
Message
From
18/10/2000 11:42:37
Cindy Winegarden
Duke University Medical Center
Durham, North Carolina, United States
 
 
To
18/10/2000 10:43:34
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00430870
Message ID:
00430966
Views:
10
>Jim, I can not use a LEFT JOIN cause table2 is a child and has many part_numbers of the same and table1 is the parent with unique part_numbers.
>example....
>table1 value
>part_number 123
>
>table2 value
>part_number 123
>part_number 123
>Part_number 123
>any other ideas?

SELECT Table1.Part_number, Table2.St, States.State_name ;
FROM Table1 LEFT JOIN Table2 ON Table1.Part_number = Table2.Part_number ;
LEFT JOIN States ON Table2.St = States.St ;
INTO CURSOR MyResult ;
GROUP BY Table1.Part_number, Table2.St, States.State_name

Please read under SELECT-SQL in the docs and see the difference/similarities between SELECT DISTINCT and GROUP BY. There are extensive discussions of things like this in Joe Celko's SQL For Smarties, Second Edition, which is what I have studied to learn SQL where the FoxPro docs didn't tell me enough.

As programmers, we ALL work with "other people's code" on a daily basis. Those of us who volunteer to help others here volunteer to help them with problems WE didn't create. Part of what makes a good programmer is learning how to figure out OPC and refine it to make it faster or more efficient or easier to understand and maintain.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform