How to get number of PK used as FK?
SELECT id 
FROM table1
WHERE EXISTS (SELECT 1
              FROM table2
              WHERE table1.id = table2.id)
  AND /* OR */
      EXISTS (SELECT 1
              FROM table3
              WHERE table1.id = table3.id)


When you need ids which are present both in table1 and table3, use AND.

When you need ids which are present at least in one of these tables, use OR.