Here is the db schema
Tables-

I want to write a query to search all files which have a metadata value like(‘abc’)
and get a specific corresponding metadata value for that file.
So for above search for all files which have abc1 as one of the values and give me its corresponding ‘geo’ key’s value.
I know it can be done by a subquery. But want to find the most efficient way.
Could look like this. Should be the most efficient way, too.
Be sure to assign aliases to multiple instances of the same table in one query.
For an overview of related query techniques see this lineup: How to filter SQL results in a has-many-through relation.