1

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?

2
  • 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. Commented Sep 14, 2016 at 0:35
  • Hi, David, this is just an example, but I'm still want to know how to do it in one query in documentDB? thanks. Commented Sep 14, 2016 at 15:14

1 Answer 1

1

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.