+ Start a Discussion
Amogh BabhaleAmogh Babhale 

Trailhead challenge of SOQL for admin

Hi All,

I trying to complete the Modudle SOQL for Admins and stuck on one stage.

In the Fourth Stage "Create Relationship Queries with Custom Objects"

The link of the mudle:-https://trailhead.salesforce.com/content/learn/modules/soql-for-admins/create-relationship-queries-with-custom-objects

I not able to colete the chanllenge where it ask to write a query and assign to list.

So the query is that 

Create a query and assign the query results to the list
Get this information:
The name of the property
The broker’s email address
How long the property has been on market
(Hint: Use API names, not field names or field labels)
Object: Property
Condition: The property was listed within the last 30 days

I am Stuck on "Condition" part where they want listed Property is are within 30 days.

I wrote a query  

SELECT Name, Broker__r.Email__c,Days_On_Market__c FROM Property__c  WHERE

but not able to write a logic for WHERE Clause becase the listed date field is Date type field.

So how can we write the logic for WHERE Clause.

Thanks !! 
VinayVinay (Salesforce Developers) 


We have separate Trailhead team who can help you with these issues.So,can you please use the below link to reach out to them so that one of the agent will get in touch with you.

Thank you!

Kindly let me know if it helps you and close your query by marking it as solved so that it can help others in the future.

Vinay Kumar
Amogh BabhaleAmogh Babhale
Hi Vinay,

Thank you for your response .

This is an general query I have about SOQL topic , I am not facing any technical issue witht my  Traihead account.

I will change the catogory of this quetion.

Thanks !!
VinayVinay (Salesforce Developers) 
Can you try below
SELECT Name, Broker__r.Email__c,Days_On_Market__c FROM Property__c  WHERE Days_On_Market__c = LAST_N_DAYS:30

Vinay Kumar
Amogh BabhaleAmogh Babhale
Hi Thanks you for the solution.

Itried that but did not worked 
VinayVinay (Salesforce Developers) 
Do you see any errors?

Try to check below date formats.


Vinay Kumar
Tejas ShettyTejas Shetty
Hi Amogh,

Please use below query and try:
[SELECT Name,Broker__r.Email__c,Days_On_Market__c from Property__c WHERE Days_On_Market__c  <= 30 ]