How to retrieve the correct Account records from SOQL query?Return more than 2000 records (SOQL)Using a specific dynamic date in a SOQL query where clauseQuery Optimization for Bulk data using a Formula field in the WHERE clauseSOQL query with inner query doesn't recognize understand the relationshipSOQL Query to compare dates on child object recordsSOQL query in Visualforce page returning only first 250 records when text area (long) is included in queryNot all records returned in SOQL QueryGet last modified data older than 30 days from now in SOQL
Python: write 2**n - 1 as a recursive function
Would fantasy dwarves be able to invent and/or manufacture the radio?
Is there a general theory of "compactification"?
What's the part number of this LEGO element?
Heat-shrink tubing available as a roll like adhesive tape?
should I include offer letter from a different institution in my application for a faculty position
How do social media apps notify you when someone else takes a screenshot of your profile?
SpaceX Starship landing on Moon or Mars: why doesn't it fall over?
Was Hitler exclaiming "Heil Hitler!" himself when saluting?
Why does Ubuntu resolve the name `_gateway` to the default gateway instead of `gateway`?
What happened to SEV?
Why is Microwaved mac & cheese burnt where they touch?
Duality in mixed integer linear programs
Response to referee after rejection
What kind of mathematical disciplines would be most useful for physics?
Palindrome and Reverse a String Problems (JavaScript, Python)
Is encrypted e-mail sent over TLS 1.3 a form of "forward secrecy" (similar to something like Signal)?
What are the meanings of `B.C. 3/8"` and `6-11/32"`?
Can a standard NEMA 5-15 outlet be installed in a round ceiling box?
Piece de Resistance - Jack in all Tags... But Master in All?
Can I catch arrows if I am not a monk?
High power microwave weapons for future spacecraft in somewhat hard sci-fi setting
Copying files: Does Windows write to disk if files are identical
Is rent considered a debt?
How to retrieve the correct Account records from SOQL query?
Return more than 2000 records (SOQL)Using a specific dynamic date in a SOQL query where clauseQuery Optimization for Bulk data using a Formula field in the WHERE clauseSOQL query with inner query doesn't recognize understand the relationshipSOQL Query to compare dates on child object recordsSOQL query in Visualforce page returning only first 250 records when text area (long) is included in queryNot all records returned in SOQL QueryGet last modified data older than 30 days from now in SOQL
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty
margin-bottom:0;
In account record I have a custom myDate__c
field of type date.
I need to retrieve all Account records where myDate__c
is older than 45 days.
I've tried with the following query:
SELECT id, name
FROM Account
WHERE myDate__c <= today() - 45
However I received a warning message:
Date and number are incompatible types
How to change my query to retrieve the correct Account records?
I need only SOQL. No Apex.
soql query date
add a comment
|
In account record I have a custom myDate__c
field of type date.
I need to retrieve all Account records where myDate__c
is older than 45 days.
I've tried with the following query:
SELECT id, name
FROM Account
WHERE myDate__c <= today() - 45
However I received a warning message:
Date and number are incompatible types
How to change my query to retrieve the correct Account records?
I need only SOQL. No Apex.
soql query date
add a comment
|
In account record I have a custom myDate__c
field of type date.
I need to retrieve all Account records where myDate__c
is older than 45 days.
I've tried with the following query:
SELECT id, name
FROM Account
WHERE myDate__c <= today() - 45
However I received a warning message:
Date and number are incompatible types
How to change my query to retrieve the correct Account records?
I need only SOQL. No Apex.
soql query date
In account record I have a custom myDate__c
field of type date.
I need to retrieve all Account records where myDate__c
is older than 45 days.
I've tried with the following query:
SELECT id, name
FROM Account
WHERE myDate__c <= today() - 45
However I received a warning message:
Date and number are incompatible types
How to change my query to retrieve the correct Account records?
I need only SOQL. No Apex.
soql query date
soql query date
edited May 29 at 0:20
Jackson Chen
2,3722 gold badges6 silver badges28 bronze badges
2,3722 gold badges6 silver badges28 bronze badges
asked May 28 at 21:15
sfdcadmdevsfdcadmdev
424 bronze badges
424 bronze badges
add a comment
|
add a comment
|
1 Answer
1
active
oldest
votes
I recommend you read up on Date Formats and Date Literals in the SOQL and SOSL Reference
. This resource covers several ways you can format date fields that you may find useful in the future. Specifically for your current use case:
Date Literal
LAST_N_DAYS:n
Range
For the number n provided, starts 00:00:00 of the current day and continues for the past n days.
Example
SELECT Id FROM Account WHERE CreatedDate = LAST_N_DAYS:365
add a comment
|
Your Answer
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "459"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/4.0/"u003ecc by-sa 4.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsalesforce.stackexchange.com%2fquestions%2f263999%2fhow-to-retrieve-the-correct-account-records-from-soql-query%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
I recommend you read up on Date Formats and Date Literals in the SOQL and SOSL Reference
. This resource covers several ways you can format date fields that you may find useful in the future. Specifically for your current use case:
Date Literal
LAST_N_DAYS:n
Range
For the number n provided, starts 00:00:00 of the current day and continues for the past n days.
Example
SELECT Id FROM Account WHERE CreatedDate = LAST_N_DAYS:365
add a comment
|
I recommend you read up on Date Formats and Date Literals in the SOQL and SOSL Reference
. This resource covers several ways you can format date fields that you may find useful in the future. Specifically for your current use case:
Date Literal
LAST_N_DAYS:n
Range
For the number n provided, starts 00:00:00 of the current day and continues for the past n days.
Example
SELECT Id FROM Account WHERE CreatedDate = LAST_N_DAYS:365
add a comment
|
I recommend you read up on Date Formats and Date Literals in the SOQL and SOSL Reference
. This resource covers several ways you can format date fields that you may find useful in the future. Specifically for your current use case:
Date Literal
LAST_N_DAYS:n
Range
For the number n provided, starts 00:00:00 of the current day and continues for the past n days.
Example
SELECT Id FROM Account WHERE CreatedDate = LAST_N_DAYS:365
I recommend you read up on Date Formats and Date Literals in the SOQL and SOSL Reference
. This resource covers several ways you can format date fields that you may find useful in the future. Specifically for your current use case:
Date Literal
LAST_N_DAYS:n
Range
For the number n provided, starts 00:00:00 of the current day and continues for the past n days.
Example
SELECT Id FROM Account WHERE CreatedDate = LAST_N_DAYS:365
answered May 28 at 21:21
Adrian Larson♦Adrian Larson
117k19 gold badges141 silver badges282 bronze badges
117k19 gold badges141 silver badges282 bronze badges
add a comment
|
add a comment
|
Thanks for contributing an answer to Salesforce Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsalesforce.stackexchange.com%2fquestions%2f263999%2fhow-to-retrieve-the-correct-account-records-from-soql-query%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown