Tag Schema select intersection
You must ensure that both combinations exists.


-- I'd like all samples that have labels of &quot;narf=zord&quot; AND &quot;foo=bar&quot;
-- AND l.key = 'foo' AND l.value = 'bar'
WITH pairs AS
(
    SELECT s.id AS sample_id, s.prefix AS sample, l.id AS label_id, l.key, l.value
    FROM   samples s 
    JOIN   sample_labels sl ON (s.id = sl.sample_id)
    JOIN labels l ON (sl.label_id = l.id)
)
SELECT p.sample_id, p.sample, p.label_id, p.key, value
FROM   pairs p
WHERE  EXISTS (SELECT 1 
               FROM   pairs 
               WHERE sample_id = p.sample_id and key = 'narf' AND value = 'zord')
AND    EXISTS (SELECT 1 
               FROM   pairs 
               WHERE sample_id = p.sample_id and key = 'foo' AND value = 'bar');


sample_id | sample              | label_id | key  | value
--------: | :------------------ | -------: | :--- | :----
        1 | narf=zord &amp; foo=bar |        1 | narf | zord 
        1 | narf=zord &amp; foo=bar |        2 | foo  | bar  


dbfiddle here