title: Syntax error on sqlite when updating table
body: <p>I'm pulling data from my energy provider as a rawTable and then would like to perform some calculations to place the data in an easier way to search as well as to do calculations.</p>
  <p>The data I receive from the energy supplier lands in this table:</p>
  <pre><code>CREATE TABLE &quot;rawData&quot; (
      &quot;ID&quot;    INTEGER NOT NULL,
      &quot;consumption&quot;   REAL NOT NULL,
      &quot;startTime&quot; TEXT NOT NULL,
      &quot;endTime&quot;   TEXT NOT NULL,
      PRIMARY KEY(&quot;ID&quot; AUTOINCREMENT)
  );
  </code></pre>
  <p>I then created this table to hold the data I want per day.</p>
  <pre><code>CREATE TABLE &quot;structuredData&quot; (
      &quot;rowID&quot; INTEGER NOT NULL,
      &quot;Year&quot;  INTEGER NOT NULL,
      &quot;Month&quot; INTEGER NOT NULL,
      &quot;Day&quot;   INTEGER NOT NULL,
      &quot;PeakConsumption&quot;   REAL,
      &quot;OffPeakConsumptioon&quot;   REAL,
      PRIMARY KEY(&quot;rowID&quot; AUTOINCREMENT)
  );
  </code></pre>
  <p>To get the offpeak consumption from the rawData, I run the following query:</p>
  <pre><code>INSERT INTO structuredData (Year, Month, Day, OffPeakConsumptioon)
  SELECT strftime('%d', startTime) as valDay,
  strftime('%m', startTime) as valMonth,
  strftime('%Y', startTime) as valYear,
  SUM(consumption) as valTotalDay
  FROM rawData
  WHERE
  strftime('%Y', startTime)&gt;='2021'
  AND (strftime('%H:%M:%S',startTime) &gt;= &quot;00:30:00&quot;
  AND strftime('%H:%M:%S',startTime) &lt; &quot;04:30:00&quot;)
  GROUP BY valYear, valMonth, valDay ;
  </code></pre>
  <p>Then I need to essentially do the same to the Peak Consumption and came up with this query:</p>
  <pre><code>UPDATE structuredData 
  SET PeakConsumption = daily.amt
  FROM (SELECT SUM(consumption) as amt, strftime('%d', startTime) as valDay,  strftime('%m', startTime) as valMonth,  strftime('%Y', startTime) as valYear
                  FROM rawData
                  WHERE   strftime('%Y', startTime)&gt;='2021'
                  AND (strftime('%H:%M:%S',startTime) &gt;= &quot;00:00:00&quot; AND strftime('%H:%M:%S',endTime) &lt;= &quot;00:30:00&quot;
                  OR strftime('%H:%M:%S',startTime) &gt;= &quot;04:30:00&quot; AND strftime('%H:%M:%S',endTime) &lt;=&quot;23:30:00&quot;)
                  GROUP BY valYear, valMonth, valDay) AS daily
   WHERE structuredData.Day = daily.valDay
   and structuredData.Month = daily.valMonth
   and structuredData.Year = daily.valYear;
  </code></pre>
  <p>However, this tells me there's an error.</p>
  <p>Execution finished with errors.
  Result: near &quot;FROM&quot;: syntax error
  At line 1:
  UPDATE structuredData
  SET PeakConsumption = 1
  FROM</p>
  <p>Any ideas where I may be messing up??</p>