AnsweredAssumed Answered

eSQL: Getting Single Record closest to TimeStamp

Question asked by dig on Oct 28, 2017
Latest reply on Nov 3, 2017 by dig

Hi All - Very new to eSQL, This works almost, however it is giving more than what I want.

 

I only want to get one record id for the most current (highest) timestamp that does not exceed the end of month date which I set as a timestamp

 

ExecuteSQL(

"SELECT (id)

FROM Reading

WHERE zzCreationTimestamp >= ?

AND zzCreationTimestamp <= ?

AND id_Equipment = ?

" ; "" ; "" ; Get ( CurrentTimestamp ) ; Reading::flag_EOM1 Copy ; "6B817185-15A4-E44B-80B8-2A15E33ABBA2"

 

)

 

NOTE: flag_EOM1 Copy = GetAsTimestamp ( Let ( x = Get ( CurrentDate ) ;

         Date ( Month ( x ) + 1 ; 1 ; Year ( x ) ) - 1

      ) )

 

Currently, it pulls two records, even though one has a higher timestamp by two minutes.

 

I hope this is enough information, appreciate any assistance.

Attachments

Outcomes