Contents
Can you select more than one field in a subquery?
The SELECT clause contains scalar values, so it can’t handle subqueries returning more than field, or multiple records of one field.
Can a subquery return more than one column?
My problem, however, is if I want to return more than one column from the EVENT table – while still at the same time preserving the possibility that there are no matching rows from the EVENT table. The above code only returns EVENT.DATE as the single subquery result, to ONE column of the main query.
When to run the exists and not exists query?
When you run a query such as the ones above, it should be noted that the subquery runs first. The subquery in the EXISTS and NOT EXISTS statements is the query that returns order records. This query runs first. Then, the main or “outer” query runs. In the above examples, the outer query is the select statement based on the customers table.
Why is the subquery returned without a value?
Note that if there do not exist any Events which match the criteria, the line is still returned but without a value. This is because the subquery is in the SELECT clause. This works just fine.
Why is the contact list not being filtered?
Why isn’t the Contact list being filtered? (well, obviously b/c there’s no WHERE clause in it, but what WHERE clause provides what I want?) I know I could do this by doing the CampaignMember query on its own and looping through it to prep a Contact query, but that seems like a lot of extra processing when a subquery should work.
What do I want in Salesforce soql query?
I want: A list of Contact objects containing only contacts who are CampaignMembers of a set of campaigns; and they should have the data from that Campaign member easily accessible. (my eventual goal is a VF page with a list of all Contacts connected to any of these campaigns with a grid indicating their status for each campaign.)