Avatar of m_jundi
m_jundi
Flag for Jordan asked on

ORACLE QUERY QUESTION

Hello
Have the following 3 tables :

Table One : Jobs
Job No.    Job date
1                10/09/2015
2                11/09/2015

Table Two : Progress

Job No.  Progress_code  Progress Date
1              1                         10/09/2015
1              2                         15/09/2015
1              3                         16/09/2015
2              1                         11/09/2015
2              2                         11/09/2015
2              3                         12/09/2015  

Table Three : Pro_progress

1  Receive
2  Repair
3 Test

Required Query result :

Job No.        Job Date             1-Receive       Days Between Repair and Receive    2-Repair            days betw test/repair          3-Test
1               10/09/2015            10/09/2015                             5                                 15/09/2015                 1                                 16/09/2015
2               11/09/2015            11/09/2015                             0                                 11/09/2015                 1                                 12/09/2015
Oracle DatabaseDatabases

Avatar of undefined
Last Comment
johnsone

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
johnsone

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
SOLUTION
Sean Stuber

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
m_jundi

ASKER
mmm, becuase I have just posted a sample for Pro_progress, it has more than Receive, Repair,Test....other 20 Records
so Need something Dynamic
Sean Stuber

>>> so Need something Dynamic

you can't.  
As noted above - SQL doesn't work that way.

If you can use pl/sql and generate a report then ok.  If you're looking for a sql statement then you'll have to specify the 20 fields
johnsone

Is it truly dynamic?  Could there really be a new status added to the tables without some sort of other significant code change?  It would seem to me that while the number is large, it should be fairly static.  A lengthy query to write, but certainly possible.  What has been posted already is your framework, just keep adding more status codes to it.
Your help has saved me hundreds of hours of internet surfing.
fblack61