SELECT
    camRun.cam_id,
    chipProcessedImfile.*,
    (IF(exp_time IS NOT NULL AND deteff_magref IS NOT NULL,
       (2.5 * LOG10(exp_time) + chipProcessedImfile.deteff_magref),  NULL))
        AS deteff_inst,
    rawExp.exp_name,
    rawExp.camera,
    rawExp.telescope,
    rawExp.filelevel
FROM camRun
JOIN chipRun
    USING (chip_id)
JOIN chipProcessedImfile
    USING (chip_id)
JOIN rawExp
  ON chipProcessedImfile.exp_id = rawExp.exp_id
LEFT JOIN camProcessedExp
    USING(cam_id)
LEFT JOIN camMask
    ON camRun.label = camMask.label
WHERE
    camMask.label IS NULL
