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
Jonathan Wolff 7Jonathan Wolff 7 

Combine Event and Task Query into one

Hello,

I want to combine to querys from task and event together into one query. Can you tell me how I can achive this the beste way?
The UNION command didnt work in the developer console.

Greetings
Jonathan
AnkaiahAnkaiah (Salesforce Developers) 
Hi Jonathan,

Do you want to query any object related task & event records?

If yes then try with below.
Select id, name, (Select Id From Tasks), (Select Id  From Events) From Opportunity

If this helps, Please mark it as best answer.
​​​​​​​
Thanks!!