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
KC0798KC0798 

Apex Explorer and SQL Syntax

Hi,
 
Anyone can tell me which DB salesforce is using? I'm trying to run some queries using the APex Explorer, but don't now how to work comparisons for date fields.
 
Eg. Like to do comparison on dates fields against today's date.
 
Select o.AccountId, o.Claim_Date__c, o.Id, o.Installation_Completed_Date__c, o.Installation_Start_Date__c, o.Name, o.OwnerId, o.Progress_Claim_Interval__c from Opportunity o where (o.Claim_Date__c <> null and o.Installation_Completed_Date__c = null and o.Installation_Start_Date__c <> null and o.Claim_Date__c < TODAY()??)
 
Thanks,
KC
 
 
dotnet developedotnet develope

Hi KC,

SF.com DB is ORACLE. but directly u cant run querys.

my suggestion is download "sforce Explorer" . it will help to solve ur issue.

:smileyhappy:

sfdcfoxsfdcfox

Salesforce uses SOQL, not SQL. You can't expect quite the same functionality. In your case though, you can do this query:

Code:
Select o.AccountId, o.Claim_Date__c, o.Id, o.Installation_Completed_Date__c, o.Installation_Start_Date__c, o.Name, o.OwnerId, o.Progress_Claim_Interval__c from Opportunity o where (o.Claim_Date__c <> null and o.Installation_Completed_Date__c = null and o.Installation_Start_Date__c <> null and o.Claim_Date__c < TODAY)


 

TODAY happens to be a date literal that you can use when querying dates. You should check out the documentation (http://wiki.apexdevnet.com/Web_Services_API) for more information on this syntax as well (and the SForce Explorer, of course!).

KC0798KC0798
Thanks guys!
dotnet developedotnet develope

Hi KC,

i think the below query will help u

Select o.AccountId, o.Claim_Date__c, o.Id, o.Installation_Completed_Date__c, o.Installation_Start_Date__c, o.Name, o.OwnerId, o.Progress_Claim_Interval__c from Opportunity o where (o.Claim_Date__c <> null and o.Installation_Completed_Date__c = null  ) and ( o.Installation_Start_Date__c <> null and o.Claim_Date__c < TODAY)

if it wasn't work,Can u give me the credentials for testing ur query.

 

:smileyhappy:

KC0798KC0798
Hey Thanks!