Q:

sqlite get distinct from column 1 where column 1 and column 2 meets multiple requirements

I'm not entirely sure how possible this is in a select statement, or if I'm better getting all results and doing checks myself in Android Studio.
I've got 3 tables, a table that stores Recordings, a Table that stores Tags and a table that links the Tags to the Recordings - TagsLink.
The TagsLink table has 2 columns, one that stores the TagsID and one that stores the RecordingsID
What I'm hoping to do is only return RecordingsIDs that meet the selected Tags criteria.  So if TagsID 3 is selected, Recordings 1, 2 and 4 are returned.  And if TagsID 3 and 4 are selected, it returns only Recordings 2 and 4.
In my mind it's something along the lines of:
SELECT DISTINCT RecordingsID FROM TagsLink WHERE ... 

If this isn't entirely possible, any advice on other ways of achieving this (even if it requires restructuring the database) would be greatly appreciated!

A:

With this kind of query:
SELECT
RecordingsID
FROM
TagsLink
WHERE
TagsID IN (3, 4, ...)
GROUP BY
RecordingsID
HAVING COUNT(*) = 2 -- This number must match the number of tag IDs specified in the IN (...) list.

The key is to remember to adjust the count based on the tags you want to filter on.
Other similar and helpful answers here and here and here.
EDIT
To accommodate additional tables, filtering on different columns, use INTERSECT as follows:
SELECT
RecordingsID
FROM
TagsLink
WHERE
TagsID IN (3, 4, ...)
GROUP BY
RecordingsID
HAVING COUNT(*) = 2 -- This number must match the number of tag IDs specified in the IN (...) list.

INTERSECT

SELECT
RecordingsID
FROM
ContactsLink
WHERE
ContactsID IN (100, ...)
GROUP BY
RecordingsID
HAVING COUNT(*) = 1 -- This number must match the number of contacts IDs specified in the IN (...) list.

