1
votes

I'd like to query the document DB with a query like this:

SELECT * FROM c 
WHERE (
    c.ReportType = 'MyReport' 
    And c.TenantId='testTenantId_111111' 
    And c._ts = (
        SELECT Top 1 c._ts FROM c 
        WHERE (c.ReportType = 'MyReport' And c.TenantId='testTenantId_111111') 
        order by c._ts Desc
    )
)

But it does not work.

Does document DB support this kind of query?

1
Not sure if this is a contrived example or the real deal, but... it looks like this example can be done in a single query. - David Makogon
Hi, David, this is just an example, but I'm still want to know how to do it in one query in documentDB? thanks. - urlreader

1 Answers

1
votes

It does not support nested queries. You have to query twice. If you need consistency between the two queries, you can do both from within a stored procedure.