You need to sign in to do that
Don't have an account?

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
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
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
please check below link
http://wiki.developerforce.com/page/A_Deeper_look_at_SOQL_and_Relationship_Queries_on_Force.com