Database operations (c) multi-table associated

1, multi-association list

Sometimes the results of a query need to extract the field data from two or more tables, required in this case is a multi-table associated with the query.

[Example]

Query student class information, it must query the table by associating student and class two tables.

  • Student and class table table table by foreign key GardeName__c student association. That GradeName__c ID field associated with the table of students by class table.
  • All information can be accessed through the class table associated field GradeName__r.

(1) Create a table Grade.

 (2) add a field GradeName in the student table, select the data type is "lookup relationship."

(3) related objects Select Grade.

 

(4) default action is completed.

(5) Add two records to the Grade table, and modify the student table Student Class name.

(6) query class student information.

 

Guess you like

Origin www.cnblogs.com/drink186/p/11084367.html