cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Microsoft
Microsoft

Extract value from one table if their values match the 2nd table

**Background:**

I have two tables within a CosmosDB database that hold key:value documents within their containers.
T1 and T2


T1

Id: 111
ems_featurecategory: 1234
ems_name: "win"

 

T2

feature_category: "win"
feature_category: "hello"

 

I wish to query cosmosdb so that I:

Return the value from T1 ems_featurecategory key if the ems_name value from T1 matches the feature_category value from T2.

 

**Desired Output:**

So since the ems_name key's value from T1 matches the featurecategory's key's value from T2

ems_name: "win"
featurecategory: "win",

the value that will be returned will be: 1234

 

 

**My approach:**

JOIN the two tables and perform a query such as:

SELECT c.emsfeaturecategory, c.ems_name, f.feature_category
FROM c
JOIN f in c.id
WHERE array_contains(['',''],c.id,true)
AND c.ems_name = featurecategory...

 

I am not sure how to write this query out successfully. Any suggestions or advice is helpful.

 

 

1 REPLY 1
Highlighted
Super User II
Super User II

Re: Extract value from one table if their values match the 2nd table

Hello @jasmine2020 

Not really related to Power Automate 🙂 but here goes - I would use an INNER JOIN to get records from T1 which are found in T2 - like this:

SELECT T1.ems_featurecategory, T1.ems_name, T2.feature_category
FROM T1
INNER JOIN T2 ON T1.ems_name = T2.feature_category

Kind regards, John

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

Power Platform ISV Studio

Power Platform ISV Studio

ISV Studio is designed to become the go-to Power Platform destination for ISV’s to monitor & manage published applications.

Upcoming Events

Experience what’s next for Power Automate

See the latest Power Automate innovations, updates, and demos from the Microsoft Business Applications Launch Event.

Top Solution Authors
Top Kudoed Authors
Users online (6,924)