SELECT *
FROM (
    SELECT
        summitImfile.*,
        summitExp.dateobs
    FROM pzPendingImfile
    JOIN summitImfile
        USING(exp_name, camera, telescope, class, class_id)
    JOIN summitExp
        USING(exp_name, camera, telescope)
    ORDER BY
        summitExp.dateobs
) as Foo
