title: sqlite group by update where max
body: <p>I am trying to do a update on a SQLite table, to set a column value to 1 only if that row has the max value of a particular column in that grouping.</p>
  
  <p>Ex:
  Grouping by BookID, set Latest=1 only when BookVersion is max.</p>
  
  <pre><code>BookID BookVersion 
  ==================
  ABC      1
  ABC      2
  ABC      3
  DEF      1
  
  Output
  BookID BookVersion Latest
  ==========================
  ABC        1         0
  ABC        2         0
  ABC        3         1
  DEF        1         1
  </code></pre>
  
  <p>I tried </p>
  
  <pre><code>update Books set Latest=1 from Books INNER JOIN (select BookId, MAX(BookVersion) from Books GROUP BY BookId );
  </code></pre>
  
  <p>I receive:</p>
  
  <p><code>SQL error: near "from": syntax error</code></p>
  
  <p>Any ideas?</p>