AnsweredAssumed Answered

Using sql to get minimum date

Question asked by Diver on May 7, 2016
Latest reply on May 7, 2016 by erolst

I am trying to get the minimum/earliest date found in all records of a table but am having no luck.  The field is a simple date field and my sql is looking like:

 

ExecuteSQL (

"SELECT MIN(a.\"dateEntered\")

FROM \"myTable\" a

WHERE a.\"dateEntered\" > ?" ;

"    " ; "|*|" ;

"5/1/16"

)

 

The result returns a number: 1126

 

 

I can get the number of records found with no problem using:

 

ExecuteSQL (

"SELECT COUNT(a.\"dateEntered\")

FROM \"myTable\" a

WHERE a.\"dateEntered\" > ?" ;

"    " ; "|*|" ;

"5/1/16"

)

 

I am only guessing it might have to do with how sql uses dates versus FileMaker.  Any help would be greatly appreciated!

Outcomes