help w/ select statement in normalized db

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View

can anyone share the best way to retrieve from a normalized db? My goal
is to get the engines.eng_definition. Here's what I have:

thehub: 1N

carinfo: 2n

engines: 3n

my query has to get the item number from theHub.  Is there a way for me
to JOIN these together?  I understand how to do a JOIN on theHub and
carinfo but can I join engines in the same select statement?
 right now this is what I have.  Keep in mind there are other items
being retrieved.

Select x, y, z
FROM  thehub INNER JOIN carinfo ON (thehub.item_no = carinfo.item_no)

Re: help w/ select statement in normalized db

shivers3000 wrote:
Quoted text here. Click to load it

Yes, SQL permits syntax to join an unlimited number of tables together,
at least in theory.  However, there is a practical limit that comes from
the database software design, and the finite amount of memory on a computer.

Anyway, here's how I'd do the join for your situation:

SELECT x, y, z, ...etc...,
   h.item_no, e.eng_definition
FROM thehub AS h
   INNER JOIN carinfo AS c
     ON h.item_no = c.item_no
   INNER JOIN engines AS e
     ON e.eng_ID = c.eng_ID

Bill K.

Re: help w/ select statement in normalized db

works perfectly......thank you....    I knew it was something simple


Site Timeline