Query keeps on giving me 'unknown column' issue I've researched quite a lot for the past few days about this error that I'm getting but I cannot really fix it so I was hoping somebody could help me. The query keeps on telling me:

ERROR 1054 (42S22): Unknown column 'updated_at' in 'field list'


This is the query:

SELECT  TIME_TO_SEC(SUM(TIMEDIFF(updated_at, created_at))) AS total FROM
        ( SELECT  DISTINCT date(l.created_at), 
                ( SELECT  MIN(created_at)
                    FROM  logs
                    WHERE  updated_at BETWEEN l.created_at AND l.updated_at
                ) AS TIME_ENTER,
                ( SELECT  MAX(updated_at)
                    FROM  logs
                    WHERE  created_at BETWEEN l.created_at AND l.updated_at
                ) AS TIME_EXIT
            FROM  logs l
        ) AS whatever
    WHERE  updated_at &lt;&gt; CONVERT(updated_at USING ASCII)
    GROUP BY  date(created_at);


and the description of my table would be:

+-------------+------------------+------+-----+---------+----------------+
| Field       | Type             | Null | Key | Default | Extra          |
+-------------+------------------+------+-----+---------+----------------+
| id          | int(10) unsigned | NO   | PRI | NULL    | auto_increment |
| job_id      | int(10) unsigned | NO   | MUL | NULL    |                |
| timecard_id | int(10) unsigned | NO   | MUL | NULL    |                |
| event_id    | int(10) unsigned | NO   | MUL | NULL    |                |
| duration    | int(11)          | YES  |     | NULL    |                |
| gap         | int(11)          | NO   |     | 0       |                |
| created_at  | timestamp        | YES  |     | NULL    |                |
| updated_at  | timestamp        | YES  |     | NULL    |                |
+-------------+------------------+------+-----+---------+----------------+


I tried looking for unprintable characters but I didn't succeed

Any help would be appreciated, thanks in advance!
The problem is that your select in the from part:

SELECT DISTINCT date(l.created_at),
(SELECT MIN(created_at) FROM logs WHERE updated_at BETWEEN l.created_at AND l.updated_at) AS TIME_ENTER,
(SELECT MAX(updated_at) FROM logs WHERE created_at BETWEEN l.created_at AND l.updated_at) AS TIME_EXIT
FROM logs l


does not return the field updated_at.