title: Insert row into MySQL table result from query into one field and SQL function returned values into other fields
body: <p>Is it possible, in one query to insert a row, into a MYSQL table and also values returned from MySQL function in other fields?</p>
  
  <p>For example, I have the following table:</p>
  
  <pre><code>CREATE TABLE monthly_hours
  (
    ProjectID int,
    Year int,
    Month int,
    monthTotalTime int
  );
  </code></pre>
  
  <ul>
  <li>which shows the time worked on a project for a given month in a given year.</li>
  </ul>
  
  <p>And I have a query that sums the total time spent on a project:</p>
  
  <pre><code>INSERT INTO time_monthly_hours ( `ProjectID`, `monthTotalTime` ) 
   SELECT jiraissue.PROJECT, SUM(worklog.timeworked) 
   FROM worklog, jiraissue 
   WHERE worklog.issueid = jiraissue.ID 
    AND jiraissue.PROJECT = 13262 
    AND worklog.startdate BETWEEN '2017-01-01 00:00:00' AND '2017-01-18 23:59:59';
  </code></pre>
  
  <p>And I want to insert the projectID and the monthTotalTime into a row in monthly_hours table, with the month and year.</p>
  
  <p>I tried:</p>
  
  <pre><code>INSERT INTO time_monthly_hours ( ProjectID, monthTotalTime,  Year, Month ) VALUES
  ( 
   SELECT jiraissue.PROJECT, SUM(worklog.timeworked) 
   FROM worklog, jiraissue 
   WHERE worklog.issueid = jiraissue.ID 
    AND jiraissue.PROJECT = 13262 
    AND worklog.startdate BETWEEN '2017-01-01 00:00:00' AND '2017-01-18 23:59:59' 
  ), 
    MONTH(CURRENT_DATE()), YEAR(CURRENT_YEAR() );
  </code></pre>
  
  <p>But this was an invalid query. I've searched quite a bit but can't find a solution like this to put both an SQL query result AND values from a SQL function into a row at the same time.</p>
  
  <p>Please can you advise. I need to do this at the MySQL level, not via higher level tools. Thank you.</p>
  
  <p><strong>presentational update:</strong></p>
  
  <p>(question content remains the same)</p>
  
  <ul>
  <li>I tried to enhance the formatting to be more readable on request from BeNice</li>
  <li>I corrected the grammar in the title slightly (needed to use plural for fields) also "queryto" in first line of question was corrected to query to. Thanks!</li>
  </ul>