EDIT: Better explanation
I have a page with a job. The job as an idea and three skills (skill\_ids) and skill requirements (a user must have at least this skill value to be qualified). 
I click on the job to find candidates, so I have the job\_id and the three skill\_ids and skill\_id\_requirements. So I can do this so far as the first answer proposed with joins. I find all users who have the three skills. The skills are saved in skill\_ratings. So far it works as I use to find the skill\_id's only.
But now I want the value and here I have my code where I compute the final value (called rating). The rating respects all given values, but isn't a simple average or the sum of all. That's why I need the long horrible code. In the long horrible code I usually insert a user's ID. But here I need all user\_id's who have the skills mentioned above just to calculate if they are qualified. This is dynamic. 

I'm having a table where I want to find people who are qualified for a position under some requirements. Here I work with one table called skill\_ratings, but (as far as I see) need to add some subqueries. And here I have the problem. There are many subqueries and I've tried to address a parent query field. But it only seems to work in a first-grade subquery to a parent query.
Here's my structure:

```
    SELECT * FROM table t 
    WHERE EXISTS (SELECT * FROM table d WHERE x > 1 
    AND b=t.id 
    AND y <= (SELECT a FROM (MAIN SUBQUERY WITH CALCULATIONS)))
    GROUP BY xyx

```

But the error I get is: **#1054 - Unknown column 'skra.usr\_id\_get' in 'where clause'**. skra is the parent table in this case.

I want to get the following (pseudo-sql):

```
SELECT all FROM table t AS x 
WHERE EXISTS (
            SELECT all FROM table t AS y 
            WHERE y.skill_id = 1 
            AND y.usr_id_get = t.usr_id_get 
            AND y.value <= (my algorithm)
)

```

The main subquery is important so far as I want to get a computed number. Elsewhere the code works because I were able to work with predefined PHP-variables for a user's ID. But I can't do this here as I need to find the users within the boundaries of the where-clauses.

How can I solve this? Because addressing a parent-field in a subquery seems to be limited to a first-grade subquery.

EDIT: Code

```
    Code removed due to project status.

```

Error: #1054 - Unknown column 'c.usr\_id\_get' in 'where clause'