I personally feel that do not add AND t.to_date = '9999-01-01' This restriction,
Because when the two tables with the same job number, s date have been restricted in the table, it can be described
Data piece of titles tables connected must be effective, I do not know if I understand this correctly!
Alternatively, where conditions may be used, so do not connect the two tables
where conditions are selected to satisfy several criteria in two rows in the table, and then out of the selected data group, using the final polymerization function avg