By using db<>fiddle, you agree to license everything you submit by Creative Commons CC0.
CREATE TABLE A
(
AInt int,
AChar char(1)
);
CREATE TABLE B
(
BInt int,
BChar char(1)
);
INSERT INTO A (AInt, AChar) VALUES
(1, 'a'),
(2, 'a'),
(3, 'a'),
(1, 'b'),
(2, 'b'),
(3, 'b');
INSERT INTO B (BInt, BChar) VALUES
(1, 'a'),
(2, 'b'),
(3, 'c');
SELECT A.*
FROM A
JOIN B
ON AInt = BInt AND AChar = BChar;
SELECT *
FROM A
WHERE AInt IN (
AInt | AChar |
---|---|
1 | a |
2 | b |
AInt | AChar |
---|---|
1 | a |
2 | a |
3 | a |
1 | b |
2 | b |
3 | b |