John Livermore
John Livermore

Reputation: 31313

Query Cosmos for records on a specific date

Using Azure Cosmos db, I have the following data...

enter image description here

What would be the SQL query to return all records that match the date '2/29/2020' (irrespective of the time value)?

I have tried something like this (found it on another SO post), but it gives a syntax error.

select c.* from c where c.ReadingDate BETWEEN '2020-02-29' and '2020-02-29'

Upvotes: 3

Views: 1043

Answers (1)

Noah Stahl
Noah Stahl

Reputation: 7563

You could use the STARTSWITH function to match the date portion:

SELECT * FROM c where STARTSWITH(c.ReadingDate, "2020-02-29")

Upvotes: 2

Related Questions