title: MySQL returning results from one table based on id data in another table
body: <p>I tried to make this inside this question, but i am too young on #stackoverflow to post comments.
  <a href="https://stackoverflow.com/questions/3760564/mysql-returning-results-from-one-table-based-on-data-in-another-table">MySQL returning results from one table based on data in another table</a></p>
  
  <p>I cannot get this to work. My intentions are slightly different. 
  I have two tables (and more in the future) that I intend to work together. I want to keep my db size down, so instead of using full words to reference <code>time_code_department</code>, I added a column to reference the "department_id". now I want to grab all the "time_codes" from table where the "time_code_depart" id matches the variable entered.
  So if user selects "Solar" department and <code>time_code_department</code> table has "9" as the "solar" "department_id", then i want to return all the entries in "time_codes" that have the "department_id" "9" on the <code>time_codes</code> table. Which in this example would be lines with <code>id</code> 40 and 75.</p>
  
  <p>Table Structure:</p>
  
  <pre><code> ----------------------------------------------
  |                 time_codes  (table)          |
  |                                              |
  | id | department_id | code_number | code_name |
   ----------------------------------------------
  | 40 | 9             | 35          | Safety    |
  | 52 | 10            | 725         | Inventory |
  | 75 | 9             | 18          | Cabinets  |
   ----------------------------------------------
  
  
   -----------------------------------
  |      time_code_depart (table)     |
  |                                   |
  | department_id | name    | manager |
   ----------------------------------- 
  | 9             | Solar   | John    |
  | 10            | Finance | Mary    |
  | 11            | Design  | Sue     |
   -----------------------------------
  </code></pre>
  
  <p>I've tried to query:</p>
  
  <pre><code>SELECT 'department_id' 
  FROM `time_codes` 
  INNER JOIN `time_code_depart` 
  ON 'time_codes.department_id' = 'time_code_depart.department_id' 
  WHERE 'name' LIKE 'Solar'
  </code></pre>
  
  <p>and</p>
  
  <pre><code>SELECT 'time_codes.id', 'time_codes.code_number', 'time_codes.code_name' 
  FROM `time_codes` 
  ON 'time_codes.department_id' = 'time_code_depart.department_id' 
  WHERE 'time_code_depart.name' 
  LIKE 'Solar'
  </code></pre>
  
  <p>Both of these I formed based on several readings on the subject, and i have used several variation of sentax. I cannot get it to return the entries for the lines with <code>id</code> 40 and 75.
  Can you help me identify where I am going wrong?</p>