범위 사용
USING SCOPE
filterScope | Description |
---|---|
Delegated | Filter for records delegated to another user for action. For example, a query could filter for only delegated Task records. |
Everything | Filter for all records. |
Mine | Filter for records owned by the user running the query. |
MineAndMyGroups | Filter for records assigned to the user running the query and the user’s queues. |
My_Territory | Filter for records in the territory of the user running the query. This option is available if territory management is enabled for your organization. |
My_Team_Territory | Filter for records in the territory of the team of the user running the query. This option is available if territory management is enabled for your organization. |
Team | Filter for records assigned to a team, such as an Account team. |
SELECT Id, Name
FROM Account USINGSCOPE Mine
ORDER BY
[ ORDER BY fieldOrderByList {ASC|DESC} [NULLS {FIRST|LAST}] ]
SELECT Name
FROM Account
ORDER BY Name DESCNULLSLAST
SELECT Id, CaseNumber, Account.Id, Account.Name
FROM Case
ORDER BY Account.Name
SELECT Name
FROM Account
WHERE industry = 'media'
ORDER BY BillingPostalCode ASCNULLSLASTLIMIT125
LIMIT
SELECT Name
FROM Account
WHERE Industry = 'Media'LIMIT125
OFFSET
SELECT Name
FROM Merchandise__c
WHERE Price__c > 5.0
ORDER BY Name
LIMIT 100
OFFSET 10
OFFSET 사용시 고려 사항
- The maximum offset is 2,000 rows. Requesting an offset greater than 2,000 results in a NUMBER_OUTSIDE_VALID_RANGE error.
- OFFSET is intended to be used in a top-level query, and is not allowed in most subqueries, so the following query is invalid and returns a MALFORMED_QUERY error:
( Error )
SELECT Name, Id
FROM Merchandise__c
WHERE Id IN
(
SELECT Id
FROM Discontinued_Merchandise__c
LIMIT 100
OFF SET 20
)
ORDER BY Name
( OK )
SELECT Name, Id
(
SELECT Name
FROM Opportunity LIMIT10 OFFSET 2
)
FROM Account
ORDER BY Name
LIMIT 1