I'm working with an older Oracle 8 database, that has a LARGE number of 'features' in it. In case you've missed the tongue-in-cheekiness of my first sentence, this database is HORRIBLE!
Anyways, I'm plodding through doing the best that I can...but I've run into a stumbling block...I'm doing a rather nasty query, that requires joining 13 tables on their respective IDs! I can get it to work for 12 of the joins, NO problems...but the 13th join is causing me grief.
The main table is an asset table, which has rows for model_id, manufacturer_id, vendor_id, employee_id, etc. etc...each of these 'id' fields links to a corresponding table. Each of these new tables (ie. employee table, manufacturer table, model table, etc.) has a proper description of the item within it. I've performed all of these joins, without a hitch (they're all equi-joins), BUT, the employee table has a 'rank_id' field within it, that is joined to the rank table, and refers to the proper description there....this is the unlucky 13th table.
Is there a way that I can do all the other 12 table joins, AND perform the join of the
assets.employee_id-->employee.employee_id-->employee.rank_id-->rank.rank_id-->rank.description ????
As I said, the existing table structure is terrible...ugly too, but it's beyond the scope of my position to redevelop the existing database....any assistance would be helpful. I can post the actual sql statement that i have working with the 12 table join...not sure how much it'll help, but those joins are all relatively straight forward, it's this 'join of a join' that has me stumped.
Thanks in advance...
by: TroyKPosted on 2003-06-03 at 11:04:09ID: 8641117
ShaymusBane;
Not sure from your narrative what you're after other than something like this:
SELECT e.Employee_ID, e.EmpName, r.[Description] --some other column names...
FROM Assets a
INNER JOIN Employee e ON a.Employee_ID = e.Employee_ID
INNER JOIN Rank r ON e.Rank_ID = r.Rank_ID
If this isn't the solution, can you post simplified DDL, some sample data (in the form of INSERT statements), and your expected output?
HTH,
TroyK, MCSD