title: Check whether value exists in column for each group
body: <p>Having a difficult time putting what I am trying to do into words so searching is also difficult.</p>
  
  <p>Basically I am trying to look whether a certain value exists in a column, partitioned by group, and then propagate that value forward.</p>
  
  <p>In this example I want to check whether a user has completed the tutorial and set a flag that carries forward.</p>
  
  <pre><code>pk | user | ... | activity
   1 |    A | ... |  "login"
   2 |    A | ... |  "started_tutorial"
   3 |    A | ... |  "completed_tutorial"
   4 |    A | ... |  "some other activity"
   5 |    A | ... |  "logout"
   5 |    B | ... |  "login"
   6 |    B | ... |  "logout"
  </code></pre>
  
  <p>I think this should be something like</p>
  
  <pre><code>select *,
      check(activity in ('completed_tutorial')) as completed_activity
      from tbl
  </code></pre>
  
  <p>but I don't think I can use <code>check</code> in a select statement and this would be a constant flag rather than set to true only after it has been found.</p>
  
  <p>Example of what I am trying to get:</p>
  
  <pre><code>pk | user | ... | activity               | completed_tutorial
   1 |    A | ... |  "login"               |                 0
   2 |    A | ... |  "started_tutorial"    |                 0
   3 |    A | ... |  "completed_tutorial"  |                 1
   4 |    A | ... |  "some other activity" |                 1
   5 |    A | ... |  "logout"              |                 1
   5 |    B | ... |  "login"               |                 0
   6 |    B | ... |  "logout"              |                 0
  </code></pre>