I hit my head on the table, trying to figure it out. I have a table in which work data is stored, and the reasons why the work does not end. The reasons are numerical, 01.02.03, etc. You can have two reasons for your pending work. If you select two reasons, they will be stored in the same column, separated by a comma. This is an example from the JOBID table :
Job_Number User_Assigned PendingInfo
1 user1 01,02
There is another table called Wait that stores what these values actually represent. 01 = Not enough information, 02 = Not enough time, 03 = View wait. Example:
Pending_Num PendingWord
01 Not Enough Info
02 Not Enough Time
What I'm trying to do is query the database to give me all the job numbers, user numbers, pendinginfo and the pending reason. I can snatch the first value, but I can’t figure out how to make the second. What are my limited skills:
select Job_number,user_assigned,SUBSTRING(pendinginfo,0,3),pendingword
from jobid,pending
where
SUBSTRING(pendinginfo,0,3)=pending.pending_num and
pendinginfo!='00,00' and
pendinginfo!='NULL'
What I would like to see for this example would be:
Job_Number User_Assigned PendingInfo PendingWord PendingInfo PendingWord
1 User1 01 Not Enough Info 02 Not Enough Time
Thanks in advance