Results 1 to 3 of 3
Thread: MySQL multiple inner joins
Mar 23, 2014, 18:49 #1
- Join Date
- Mar 2014
- 0 Post(s)
- 0 Thread(s)
MySQL multiple inner joins
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:
SELECT ScriptName, ComputerID, ClientID, Executed, Step FROM runningscripts T1 INNER JOIN lt_scripts T2 ON T1.ScriptID = T2.ScriptID WHERE Running = 1
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.
SELECT Name FROM runningscripts T1 INNER JOIN computers T2 ON T1.ClientID = T2.ClientIDCode:
SELECT Name FROM runningscripts T1 INNER JOIN computers T2 ON T1.ComputerID = T2.ComputerID