Skip to main content
14 events
when toggle format what by license comment
Oct 26, 2016 at 12:22 comment added Patlatus @Grant: I have updated my answer to show option of using two queries
Oct 26, 2016 at 12:22 history edited Patlatus CC BY-SA 3.0
update: reducing to two queries
Oct 26, 2016 at 12:17 comment added Patlatus however... wait a second, I think you can simplify this to two query.
Oct 26, 2016 at 12:16 comment added Patlatus I mean you need three queries in this case and you can't reduce query number to value less than three
Oct 26, 2016 at 12:15 comment added Patlatus Yes, unfortunately you can't have smart query for this case. SOQL is very limited language and you can't do everything here in a one query like you could using SQL. However, if you had some different case where only one semijoin query was needed, you could do it in one query.
Oct 25, 2016 at 14:30 comment added Grant that is what I had tried originally, but I received the following error when trying: Semi join sub-selects are only allowed at the top level WHERE expressions and not in nested WHERE expressions but I understand where you're coming from with this.
Oct 25, 2016 at 14:00 comment added Patlatus For example, you could try to write such semijoin query: SELECT Id, Body (SELECT Id FROM FeedComments) FROM FeedItem WHERE (Id IN ( SELECT EntityId FROM TopicAssignment WHERE TopicId = '0TO30000000Xea1GAC ) OR ParentId in ( select ParentId from CollaborationGroupFeed WHERE ParentId = '0F936000000cWkMCAU' ) ) AND CreatedDate >= 2015-12-15T00:00:00Z
Oct 25, 2016 at 13:58 comment added Patlatus Generally you should try to have as little queries as you can to avoid hitting 101 SOQL Queries Governor Limit per transaction. Sometimes semi-joins query may help you to reduce number of queries, however, there are limitation on how complex semijoin query may be built.
Oct 25, 2016 at 13:25 history edited battery.cord CC BY-SA 3.0
Fixed missing foreach syntax
S Oct 25, 2016 at 13:23 history suggested Grant CC BY-SA 3.0
2nd for loop called TopicAssignment but should have called CollaborationGroupFeed. Updated the loop and changed variable t to c.
Oct 25, 2016 at 13:12 comment added Grant That was a good explanation, thank you. Is doing something like this a common practice? Or are multiple queries and lists considered 'rookie' and there are better alternatives?
Oct 25, 2016 at 13:10 vote accept Grant
Oct 25, 2016 at 13:10 review Suggested edits
S Oct 25, 2016 at 13:23
Oct 25, 2016 at 12:57 history answered Patlatus CC BY-SA 3.0