Checking if user owns child records (MySQL) I am having a quite big problem with the following queries. The tables looks like:

A (Parent)

+------------+---------+
| id | user_id | value |
+------------+---------+
|  1 |     20 |      X |
|  2 |     20 |      Y |
|  3 |     12 |      Z |
+------------+---------+


B (Child)

+------------+-----------+
| id | parent_id | value |
+------------+-----------+
|  1 |         1 |     X |
|  2 |         2 |     Y |
|  3 |         2 |     Z |
+------------+-----------+


C (Childs of the Child records)

+------------+-----------+
| id | parent_id | value |
+------------+-----------+
|  1 |         1 |     X |
|  2 |         1 |     Y |
|  3 |         1 |     Z |
+------------+-----------+


I need two (separate) queries. The first for verification if records in the table B belongs to the user id = X and then if records in the table C belongs to the user id = X. So for example I have got IDs (1, 2, 3, 18, 329) of records from the table C and I need to check if these values belong to the user id = 20. The result should be 1, 2, 3. How can I do this? I don't work with SQL a lot so I am completely lost and I appreciate every help. Thanks
You need a Select with 2 joins:

SELECT c.id
FROM c
  INNER JOIN b ON b.id = c.parent_id
  INNER JOIN a ON a.id = b.parent_id
WHERE c.id in (1, 2, 3, 18, 329)
  AND a.user_id = 20 ;