title: SQL Select same columns from two different tables
body: <p>I hope you are all well!</p>
  <p>I am in a situation where I have to make a SQL query to get my hands on minimum and maximum value from two columns with the same type of data limited to only one of each and same name but in two different tables.
  Currently I have a query where I can get this from one of the tables, but I can't wrap my head around how to get the MIN datetime value between the two tables and MAX datetime value between the two tables.</p>
  <p>In order to get the MAX and MIN from one table only I do like this:</p>
  <pre><code>SELECT idprojects, projectname, MIN(startDate), MAX(endDate)
  FROM projects,
       tasks
  WHERE idprojects = projectid
  GROUP BY projectid
  </code></pre>
  <p>Basically the tables are tables of tasks and subproject tasks where I wan't to display the duration of an entire project by showcasing the first date of the earliest datetime task/sptask and the latest datetime task/sptask.
  My tables looks like this:</p>
  <p><a href="https://i.stack.imgur.com/VUHBK.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/VUHBK.png" alt="Here's sptask table" /></a></p>
  <p><a href="https://i.stack.imgur.com/6ZGFY.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/6ZGFY.png" alt="Here's task table" /></a></p>
  <p><a href="https://i.stack.imgur.com/gZm3H.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/gZm3H.png" alt="Here's project table" /></a></p>
  <p>So the result I'd like to get out is only one row pr. projectid with:</p>
  <pre><code>| projectName | idprojects | MIN(startDate) | MAX(endDate) | 
  </code></pre>
  <p>Where MIN(startDate) and MAX(startDate) is the allround minimum and maximum datetime values between both sptasks and tasks tables.</p>
  <p>I really hope some one can help me here, as I've come nowhere for the time I've been trying.
  <br>Have a good one, and be safe!</p>