+ Start a Discussion
Steven HoughtalenSteven Houghtalen 

How to perform a simple table join

I am hoping someone can help me with this.  I want to perform a simple table join but I find the documenation very difficult to get to the right solution.  Here are the 2 tables (custom objects):
Service Log (custom object)
ClientID  Date of Service
24          12/16/16
34           12/1/16
15           12/20/16

Client (custom object)
ClientID       Language
24            Spanish
12            English
34            French
15            Mandrin


I want the resulting table (list) to contain the language for every record in the Service Log.  The list would have the followiong fields:
ClientID     Date of Service   Language

Hope someone can help me by showing me the needed query and perhaps point me to better documentation on how to perform the different types of table joins.
Thanks
 
Best Answer chosen by Steven Houghtalen
Steven HoughtalenSteven Houghtalen
Hi Alain,  I found my error.  What you suggested worked.  Thank you.

All Answers

Steven HoughtalenSteven Houghtalen
Thanks Alain,   I gave it a go and it partiallhy worked.  I assigned the select statement #1 to a list (SvcLogList) and all the selected fields of all hte records wound up in the list except for Client__r.Language.  I assumed that target field name would be Language__c.  But when displaying SvcLogList, it doesn't display a field named Language.  I am stumped as get no compile or run time error. 
Alain CabonAlain Cabon
Each user has his prefered language and you can get the complete language of a user like that:
select name, tolabel(LanguageLocaleKey)
from user

Your clients are not all users probably.

If your object Client__c doesn't contain a field Language,  you can look for all the relationships and with User perhaps.

Indirectly, you can access the language of the sales rep who is responsible of many clients (territories and roles).

Alain
Steven HoughtalenSteven Houghtalen
Hi Alain,  thanks for the reply.  To clarify, Clients are not SF users.   They are clients of ours and their preferred language is stored in the Client custom object.  It seems like this query should get what I want but it's not clear to me how to get it into list...i.e. how do you insturct the query where to put the contents.
Steven HoughtalenSteven Houghtalen
Hi Alain,  I found my error.  What you suggested worked.  Thank you.
This was selected as the best answer