Skip to main content
13 events
when toggle format what by license comment
May 8, 2023 at 0:48 comment added blobbles @nbk - there is no INSERT INTO statement. No CREATE TABLE statement in Cosmos. You aren't understanding that it's not a relational DB model like SQL Server. Maybe start in Microsofts getting started pages: learn.microsoft.com/en-us/azure/cosmos-db/nosql/query/… and check the first blue box for important info
May 8, 2023 at 0:44 comment added blobbles @nbk OK, just for your information, I tried your SQL Create statement in Cosmos: ERROR: One of the input values is invalid. I tried your INSERT statement: ERROR: One of the input values is invalid. I tried your SELECT statement: ERROR: One of the input values is invalid. Its a completely different implementation of SQL. Clearly you don't understand this.
May 7, 2023 at 20:22 comment added nbk as they are similar and the query works in comosdb, it really doesn't matter if the fiddle is in sql server to understand that it works
May 7, 2023 at 20:15 comment added blobbles @nbk - you do know the SQL API for Cosmos is it's own implementation of SQL? The above is tsql, NOT the Cosmos SQL API version. As KAE said, INNER JOIN is not part of the language. CREATE TABLE isn't a thing, they don't have tables, they have containers. It looks like you don't understand that it's and entirely different SQL implementation, JOINs in Cosmos are internal to the document, cos its a document DB. Your fiddle is for SQL Server, not Cosmos. Also you should be testing your code before you submit an answer, not me, I can see it's not going to work just by looking at it.
May 4, 2023 at 10:33 comment added nbk @blobbles according to learn.microsoft.com/en-us/azure/cosmos-db/nosql/query/subquery this work perfectly in cosmodb, so did you get an error?
May 3, 2023 at 23:15 comment added blobbles Person has asked for Cosmos DB. I think they have mistakenly put in "tsql" as a tag, which has confused things. This answer won't work for Cosmos DBs where a join is internal to the document, not to another table.
Apr 16, 2021 at 21:45 comment added nbk you can use simokly join the inner is implicit and remove the brackets
Apr 16, 2021 at 21:37 comment added KAE There is a SQL query test tool for Azure Cosmos DB here that seems useful for learning it, so I'll see if that helps.
Apr 16, 2021 at 21:25 comment added KAE Thanks so much. Unfortunately it seems like Cosmos DB doesn't allow INNER JOIN, or the square bracket convention like cd.[userName]. It is really hard to figure out how to write a complicated Cosmos DB query that works since it's using its own flavor of SQL. I may just dump all the data out and do it by brute force.
Apr 9, 2021 at 17:22 comment added nbk @KAE i added a query for your question.
Apr 9, 2021 at 17:22 history edited nbk CC BY-SA 4.0
added 1983 characters in body
Apr 9, 2021 at 12:45 comment added KAE I added example data to my question, thanks for pointing out that was needed. Is there an aggregator function instead of AVG that will find the bloodPressure and temperature value that was measured at the MAX(c.DateTime) for each user?
Apr 8, 2021 at 18:26 history answered nbk CC BY-SA 4.0