i have an SQL Script which generates the following Output:

```
+------------+------------+--------------------+----------------------+---------------------+
| CUSTOMERID | TOTALCOUNT | VALIDWARRANTYCOUNT | EXPIREDWARRANTYCOUNT | LASTPURCHASED       |
+------------+------------+--------------------+----------------------+---------------------+
| 1          | 5          | 5                  | 0                    | 2013-12-24 14:37:45 |
| 2          | 3          | 3                  | 0                    | 2013-12-24 14:37:45 |
| 3          | 6          | 6                  | 0                    | 2013-10-23 13:37:45 |
+------------+------------+--------------------+----------------------+---------------------+

```

I would like to see the Companyname of the Customer in a additional column. I have an extra table with `customer id` and `company name` but I don't know how to extend my query. All trys result in an empty table.

Here is my Query:

```
SELECT  p2c.customerid
    ,   (
            SELECT COUNT(*)
            FROM   products2customers
            WHERE  customerid = p2c.customerid
        ) AS TotalCount
    ,   (
            SELECT COUNT(*)
            FROM   products2customers
            WHERE  customerid = p2c.customerid
               AND date_add(from_unixtime(purchased), INTERVAL 5 YEAR) >= CURDATE()
        ) AS ValidWarrantyCount
    ,   (    
            SELECT COUNT(*)
            FROM   products2customers
            WHERE  customerid = p2c.customerid
               AND date_add(from_unixtime(purchased), INTERVAL 5 YEAR) < CURDATE()
        ) AS ExpiredWarrantyCount
    ,   (
            SELECT MAX( from_unixtime(purchased) )
            FROM   products2customers
            WHERE  customerid = p2c.customerid
        ) AS LastPurchased
FROM    (
            SELECT DISTINCT
                p2c.customerid
            FROM
                products2customers p2c
            INNER JOIN
                products p
            ON
                p2c.customerid = p.id
        ) AS p2c

```

I made an SQL Fiddle with the normal query without a join, I hope someone could give me a hint.

[SQLFiddle](http://sqlfiddle.com/#!2/60396/1)