I am working with a legacy database tying together multiple tables (4 INNER JOINS and an OUTER LEFT JOIN); because of this and how the tables have to be joined together, it’s really hard to consolidate the data. I’ve gotten this far:
+---------------------------------------------------------------------------+
| EmployeeName | HireDate | Title | Mandatory30 | Mandatory90 | MandatoryPA |
+---------------------------------------------------------------------------+
| Stewart, P. | 1/1/01 | CO | 1/1/02 | NULL | NULL |
| Stewart, P. | 1/1/01 | CO | NULL | 1/2/12 | NULL |
| Frakes, J. | 5/5/05 | XO | 5/5/05 | NULL | NULL |
| Frakes, J. | 5/5/05 | XO | NULL | 5/6/05 | NULL |
+---------------------------------------------------------------------------+
How can I consolidate this into something closer to the following?
+---------------------------------------------------------------------------+
| EmployeeName | HireDate | Title | Mandatory30 | Mandatory90 | MandatoryPA |
+---------------------------------------------------------------------------+
| Stewart, P. | 1/1/01 | CO | 1/1/02 | 1/2/12 | NULL |
| Frakes, J. | 5/5/05 | XO | 5/5/05 | 5/6/05 | NULL |
+---------------------------------------------------------------------------+
There are actually 5 of these MandatoryN fields but hopefully that doesn’t make too much of a difference in the solution.
Try something like this:
You can add as many fields as you want/need.