function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
sravan1.3948243917859526E12sravan1.3948243917859526E12 

How to Pull the data from two tables by using soql-How to get account names for account who supply part p2.

I have two tables -
accounts                                            products
id    acct name   weight           acct_id    product #           name        status
a1    raju                  25                   a1              p1                  nut              hold
a2    john                 15                   a2              p2                  bolt             open
a3    ajay                 10                    a3              p2                  screw         open
a4    ravi                   05                   a4              p2                  cam            hold
                                                          a2              p3                  amy            hold
Vamsi KrishnaVamsi Krishna
hi
you can use the query like this.. (replace the object & field names with what's there in your org)

Select Id, Name, Status, Account__r.Name form Product where ProductNumberField = 'p2'

you can run the query in developer console to see the results before using in your code or elsewhere..

also, refer this article for relationship queries in salesforce soql
http://www.salesforce.com/us/developer/docs/dbcom_soql_sosl/Content/sforce_api_calls_soql_relationships.htm
Chandra PrakashChandra Prakash
hi,
please check below link

http://wiki.developerforce.com/page/A_Deeper_look_at_SOQL_and_Relationship_Queries_on_Force.com