Hi there,

I am trying to work out some MySQL inner join commands and wondered if anybody might know how I can achieve the following.

I need to make a MySQL query that lists my running scripts table and gets the name of the script from another table.

runningscripts Table Structure: runningscripts.png

I want to output the following information: Script Name | Computer Name | Client Name | Started Running Time
where 'runningscripts.running' row = 1

The "Script Name" is stored in the 'lt_scripts.name' table
The "Computer Name" is stored in the 'computers.name' table
The "Client Name" is stored in the 'clients.name' table
The "Started Running Time" is stored in the 'runningscripts.start' table


So far, I have:
Code:
 SELECT ScriptName, ComputerID, ClientID, Executed, Step FROM runningscripts T1 INNER JOIN lt_scripts T2 ON T1.ScriptID = T2.ScriptID WHERE Running = 1
This returns The Script Name, Computer ID and Client ID Executed and Step as expected.
Result: selectrunningscripts.png

I know need am trying to figure out how to do multiple inner joins on that statement to get the Client Name and Computer Name by adding the following two joins into the query above to make one long query.
Code:
SELECT Name FROM runningscripts T1 INNER JOIN computers T2 ON T1.ClientID = T2.ClientID
Code:
SELECT Name FROM runningscripts T1 INNER JOIN computers T2 ON T1.ComputerID = T2.ComputerID
That's hard to explain, hopefully you get what I mean.