subquery not working in documentdb

时间:2016-12-02 05:06:05

标签: azure-cosmosdb

My following query is working..

SELECT d.pub_user.userid FROM d where d.pri_data.user.email="xxx@yyy.zzz"

This gives me result as below..

[
  {
    "userid": "1e4491ef27097262"
  },.....
]

The following query is also working..

SELECT * FROM c WHERE c.pub_user.userid  IN ("1e4491ef27097262")

But, when I try the following, it does not work..

SELECT * FROM c WHERE c.pub_user.userid  IN (SELECT d.pub_user.userid FROM d where d.pri_data.user.email="xxx@yyy.zzz")

It gives an error.. Syntax error, incorrect syntax near 'SELECT'

Any help is sincerely appreciated.

Thanks

1 个答案:

答案 0 :(得分:4)

目前不支持

子查询。根据{{​​3}}答案,您可以尝试利用存储过程。

当一个人开始点击联接或子查询时,早期指示您的数据文档结构不是最佳的。但是我想知道为什么在最后一个例子中没有子查询的情况下你不能通过电子邮件进行查询。喜欢这个

SELECT * FROM c WHERE c.pri_data.user.email="xxx@yyy.zzz"

如果这是不可能的,因为这些数据在单独的文档中,也许电子邮件可以添加到文档中。