Hi!!!
Query
SELECT VALUE SUM(act.duration) FROM c
JOIN act IN c.activities
WHERE act.type=”lab” AND c.event_name= “CosmosDB Conf”
Results
Query
SELECT VALUE act FROM c
JOIN act IN c.activities
WHERE act.type=”conference” AND c.event_name= “CosmosDB Conf”
Results
Query
SELECT VALUE act FROM c JOIN act IN c.activities
WHERE act.duration>30
Results
Query
SELECT VALUE { “id”:c.id,
“event”:c.event_name,
“speaker”:c.speaker,
“country”:c.event_country,
“activity”:act} FROM c
JOIN act IN c.activities
WHERE act.duration>30 and act.type=”lab”
Results
In case you have more complex JSON Document let us know. I’d like to help and be involve in other queries problems.
We will continue to play a little with the same JSON Example in Part 1
We will try to do queries a little more complicated.
Total amount of time (in minutes) of laboratory in particular event.
Query
SELECT VALUE SUM(act.duration) FROM c
JOIN act IN c.activities
WHERE act.type=”lab” AND c.event_name= “CosmosDB Conf”
Results
List activities from specific type and from specific event
Query
SELECT VALUE act FROM c
JOIN act IN c.activities
WHERE act.type=”conference” AND c.event_name= “CosmosDB Conf”
Results
Get activities where duration is more than 30 minutes
Query
SELECT VALUE act FROM c JOIN act IN c.activities
WHERE act.duration>30
Results
Same as previous but bring me more information for each document
Query
SELECT VALUE { “id”:c.id,
“event”:c.event_name,
“speaker”:c.speaker,
“country”:c.event_country,
“activity”:act} FROM c
JOIN act IN c.activities
WHERE act.duration>30 and act.type=”lab”
Results
In case you have more complex JSON Document let us know. I’d like to help and be involve in other queries problems.
To be Continue…
Comments