Note that there are some explanatory texts on larger screens.

plurals
  1. POMySQL query using INNER JOIN, Not returning what i'd expect
    primarykey
    data
    text
    <p>I'm having trouble with the following query:</p> <pre><code>SELECT costingjobtimes.TimeStamp, costingdepartment.DeptDesc, costingemployee.Name, costingjobtimes.TimeElapsed FROM costingemployee INNER JOIN (costingdepartment INNER JOIN costingjobtimes ON costingdepartment.DeptID = costingjobtimes.DeptID) ON costingemployee.EmployeeID = costingjobtimes.EmployeeID; </code></pre> <p>I would expect it to return every row in the costingjobtimes database however it's only returning 4 at current.</p> <p>Basically, I have 3 tables. (costingjobtimes, costingdepartment, costingemployee) They are as follows:</p> <pre><code>mysql&gt; DESCRIBE costingemployee -&gt; ; +------------+------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +------------+------------+------+-----+---------+-------+ | EmployeeID | varchar(8) | | PRI | | | | Name | text | | | | | +------------+------------+------+-----+---------+-------+ 2 rows in set (0.00 sec) mysql&gt; DESCRIBE costingdepartment -&gt; ; +----------+------------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +----------+------------------+------+-----+---------+-------+ | DeptID | int(10) unsigned | | PRI | 0 | | | DeptDesc | text | | | | | +----------+------------------+------+-----+---------+-------+ 2 rows in set (0.00 sec) mysql&gt; DESCRIBE costingjobtimes -&gt; ; +-------------+------------------+------+-----+---------------------+----------- -----+ | Field | Type | Null | Key | Default | Extra | +-------------+------------------+------+-----+---------------------+----------- -----+ | id | int(10) unsigned | | PRI | NULL | auto_incre ment | | EmployeeID | text | | | | | | DeptID | int(10) unsigned | | | 0 | | | JobNumber | text | | | | | | TimeElapsed | decimal(10,5) | | | 0.00000 | | | TimeStamp | datetime | | | 0000-00-00 00:00:00 | | | JobRef | text | | | | | +-------------+------------------+------+-----+---------------------+----------- -----+ 7 rows in set (0.00 sec) </code></pre> <p>So all the query is supposed to do is return all the rows from costingjobtimes, but put in the employees name instead of EmployeeID and Department description instead of the DeptID. Any help would be great..</p> <p>Thanks in advance,</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload