sql - How do I write the join in this query? -


i have following case :

two tables structure :

[machine] (parent table):

machine_id (pk) | machine_name | desc 

[machine_in_out] (child table):

id (pk) | machine_in_id | machine_out_id 

now want name of machine_in_id, machine_out_id through parent table.

how make join?!

try this...

select  mio.id,          m1.machine_name,          m2.machine_name    [machine_in_out] mio join    [machine] m1         on  mio.machine_in_id = m1.machineid join    [machine] m2         on  mio.machine_out_id = m2.machineid 

Comments

Popular posts from this blog

java - Jmockit String final length method mocking Issue -

asp.net - Razor Page Hosted on IIS 6 Fails Every Morning -

c++ - wxwidget compiling on windows command prompt -