0

I have 2 tables with entries as:

Transition table:

From_Status_Id To_Status_Id PU_Id 5 1 868 5 2 868 5 3 868 5 4 868 8 5 868 8 2 868 8 3 868 

Status table:

ProdStatus_Id ProdStatus_Desc 1 NoId-Staged 2 NoId-Running 3 Staged 4 Running 5 Complete 8 Inprogress 

I need the result in below format which would be basically the corresponding status desc value for a given status id.

Output:

from_status to_status Complete NoId-Staged Complete NoId-Running Complete Staged Complete Running Inprogress Complete Inprogress NoId-Running Inprogress Staged 

How can we achieve this result set using joins?

1
  • Use 2 JOINs... Commented Apr 29, 2022 at 12:04

1 Answer 1

2
 SELECT S.ProdStatus_Des AS FROM_STATUS,S2.ProdStatus_Des AS TO_STATUS FROM Transition AS T JOIN Status AS S ON T.From_Status_Id=S.ProdStatus_Id JOIN Status AS S2 ON T.To_Status_Id=S2.ProdStatus_Id 
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.