Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How do I get all records from left join in this Select -
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00355646
Message ID:
00356079
Views:
15
>>>CREATE SQL VIEW CALLBACK AS ;
>>>SELECT ALL Servcalls.*, Customers.company;
>>> FROM appdata!servcalls LEFT JOIN appdata!customers ;
>>> ON Servcalls.prim_key = Customers.prim_key ;
>>> GROUP BY Servcalls.prim_key;
>>> ORDER BY Servcalls.callbacktime
>>
>Thanks Larry,
>
>The returned records where 2 different servcalls each matching a different customer. The problem was in the group by condition which blocked additional records for the same two customers being returned.
>
Hi Curtis,
Are you saying that there are many records in the Servcalls table with the same value in Prim_Key? If so, then Prim_Key is not a primary key as I thought from the name. It is the foreign key of Customers. I didn't worry about the GROUP BY clause because I saw what I thought to be an error in the JOIN condition.

Did you by chance use some third-party Entity Relation Diagraming tool to design your database? One of the *features" of these tools is to create a field with the same name in the child table when you define a foreign key relationship. If your field names are generic (e.g. Prim_Key), this could lead to misunderstandings with others that do not know your system as well as you do.

Anyway, I'm glad you got it working.
Larry Miller
MCSD
LWMiller3@verizon.net

Accumulate learning by study, understand what you learn by questioning. -- Mingjiao
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform