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
steven75steven75 

Join query doesn't work

Hi,

 

I have this query and tested in Setup/System Log/ Execute Apex and it works fine.

SELECT Account.Name, (SELECT Contact.LastName FROM Account.Contacts) FROM Account

 

However, I plugged this query in my app and it doesn't work.   and it give me this error.

INVALID_TYPE: sObject type 'account.contacts)' is not supported. If you are attempting to use a custom object, be sure to append the '__c' after the entity name. Please reference your WSDL or the describe call for the appropriate names.

If I remove  (SELECT Contact.LastName FROM Account.Contacts), then it works fine.

Any advice?

Thanks,

steven75steven75

Any workaround for this?

IraHIraH

If I'm not mastaken, you can only query one table at a time.

 

Being that you must "Create" and account (make a connection with a table. One table)

 

So, what I have done is to query one table. Get the return data and use it to query the next table.

 

Ira

blombardisblombardis

Hi Steve,

 

Have you tried with a query like this one?

 

 

Select a.Name, (Select LastName From Contacts) From Account a

 

 

Please let me know if this query heps.

 

Bruno