each column has the same employee number but different information. I'm trying to combine these 4 columns into 1. The only thing I could find was concatenation. But that won't work for me because these need to go into an array so I can build it in datatables. I would like it to look like this.
As of a week ago all of this information was coming from a flat file. A coworker created a relational table and that's when my brain exploded. We are working on Db2 and I tried to do this in php using a foreach to loop through the array and look for the empnum but I would get the same appn1 for every person. I'd like to do it sql I just can't think of how.
How do you deal with this if there are more than four rows? SQL does not have queries that can produce different amounts of column. How you consume the data is up to you. But you need to work with how you can get the data.
Exactly. That is what I am trying to do, manipulate the way I get the data. I've looked at pivots, and recursion. I can't get recursion to work so I was thinking about a stored procedure or a temporary table but the fundamental problem is how do I query and get everything from emp into a place that I can use it.