title: Update sql table daily with values from another table
body: <p>I need some help with updating a few of my sql tables that need to pull values from one main table each day. </p>
  
  <p>My main table consists of status', descriptions and dates for updates that are made to it daily. I have 3 other tables that need to pull values from that main table based on their Status ID number. For example, if it is a <strong>Type1</strong> then it gets the the number of Reds, Greens, Yellows and the current date for that Type and it needs to do this daily.</p>
  
  <p>After doing some research I saw that I need to implement something like this:</p>
  
  <pre><code>Update [TableA]
  SET Date (select Date from [TableB] where [TableB].Date = [TableA].DateDiscovered and [TableB].Date IS NOT NULL) --not sure if this is write, this is just what I found online
  </code></pre>
  
  <p>Here are some examples of my two tables that would be used:</p>
  
  <p><strong>Main Table</strong></p>
  
  <p><img src="https://i.stack.imgur.com/3E4B7.png" alt="enter image description here"></p>
  
  <p><strong>Secondary Table</strong></p>
  
  <p><img src="https://i.stack.imgur.com/YWZ7f.png" alt="enter image description here"></p>
  
  <p><em>So basically I need help with the following: the secondary table would need to count the greens, reds, oranges and yellows from the 'Status' column and put them in the designated columns. So if there were 4 greens, 2 reds, 1 yellow and 2 oranges they would be put in the corresponding columns in the secondary table. And I need this done each day and when it is done it would record the current date in the date column in the secondary table.</em></p>