Hello, I got lost little bit with this select. It seemed to be easy but not for me anymore... Thank you in advance for any help.
There is a table of JOBS, each JOB has some DrawingVersionID. There is also table DRAWINGS and each Drawing has couple of records in DRAWING VERSIONS.
I need to select all records from JOBS that are based on same DRAWING. Input parameter is DrawingVersionID=3.
It means that first I must search in table DRAWING VERSIONS where DrawingVersionID=3, it gives me DrawingID = 2. Then I must find all the records in DRAWING VERSIONS where DrawingID=2, which are records 3, 4, 5. Then I must search all records in JOBS where DrawingVersionID is 3 or 4 or 5 which will return JOBS 1,3
JOBS
JobID JobName Qty DrawingVersionID
1 Print poster 100 3
2 Print billlboard 150 1
3 Print poster 200 5
DRAWINGS
DrawingID DrawingName
1 Ford Mustang
2 Corvette
3 Ferrari
DRAWING VERSIONS
DrawingVersionID DrawingID VersionName
1 1 Brighter
2 1 Darker
3 2 Brighter
4 2 Lighter
5 2 Smaller
OUTPUT
JobID JobName Qty DrawingID DrawingName
1 PrintPoster 100 2 Corvette
3 PrintPoster 200 2 Corvette
Regards
Petr