function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
mavsmavs 

SOQl BETWEEN

Hi

 

How do we write sql BETWEEN in SOQL?

 

We have a table Startdate enddate week 3/12/2010 3/18/2010 12 3/19/2010 3/22/2010 19 If todays date is between startdate and enddate i need week value datetime t = System.now(); date dt = Date.newInstance(t.year(),t.month(),t.day()); some_Object__c temp=[Select week from some_Object__c where startdate__c>=:dt and enddate<=dt];

 

 

 

This is not giving back any results.

 

Any idea???

Best Answer chosen by Admin (Salesforce Developers) 
SuperfellSuperfell
You have the comparisons back to front, it should be where start <= :dt and end >= :dt

All Answers

SuperfellSuperfell
You have the comparisons back to front, it should be where start <= :dt and end >= :dt
This was selected as the best answer
mavsmavs
Thank you so much..i did not notice