I need to run a simple query on a table to find all the rows with a corresponding id. I then want to perform an inner join. 

```
 $applications = SELECT * FROM applications WHERE clubid = $_SESSION['id']

```

Once I have got all of the rows which meet this criteria, I then want to perform something along the lines of this. The `$applications`is just someway of storing the rows that were found from the above query. 

```
SELECT *
FROM $applications
INNER JOIN productsapplied
ON $applications.ID = productsapplied.appid;

```

Thanks for any help