I have 2 comma separated lists of people - let's call them @speaker and @visitor. I want to get - the meeting_id and person_id of the member of @speaker- from my linking table- for all meeting_ids where a member of @speaker ist involved anda) only members of @speaker are involved orb) at least one member of @visitor is involved.All statements I tried got me to few or to many results. So I hope someone here can help me.Here's some sample data (see expected results below):CREATE TABLE xfer ( meeting_id INT NOT NULL, person_id INT NOT NULL)INSERT INTO xfer (meeting_id, person_id)SELECT 1, 9 UNION ALLSELECT 2, 8 UNION ALLSELECT 2, 20 UNION ALLSELECT 3, 301 UNION ALLSELECT 4, 7 UNION ALLSELECT 4, 302 UNION ALLSELECT 5, 21 UNION ALLSELECT 6, 6 UNION ALLSELECT 6, 22 UNION ALLSELECT 6, 303 UNION ALLSELECT 7, 5 UNION ALLSELECT 7, 4
@speaker consists of (4,5,6,7,8,9)@visitor consists of (20,21,22)The person_ids > 300 are people I don't care about.I have chosen these numbers because I find it easer to see what's going on; the actual numbers are just a bunch of primary keys.Expected result:meeting_id person_id1 92 86 67 57 4
Thanks,Othar