title: Delete recursive children
body: <p>I have the following sql that gets me all the children and grandchildren of a root forumpost. </p>
  
  <pre><code>with recursive all_posts (id, parentid, root_id) as
                  (
                  select t1.id,
                  t1.parent_forum_post_id as parentid,
                  t1.id as root_id
                  from forumposts t1
  
                  union all
  
                  select c1.id,
                  c1.parent_forum_post_id as parentid,
                  p.root_id
                  from forumposts
                  c1
                  join all_posts p on p.id = c1.parent_forum_post_id
                  )
  
                  select fp.id
                  from forumposts fp inner join all_posts ap
                  on fp.id=ap.id 
                  where
                  root_id=1349 
                  group by fp.id
  </code></pre>
  
  <p>Thing is I want the records selected to be deleted. Something like delete from forumposts fp where fp.id=(<em>last select from the code above</em>) but that doesn't work(I get syntax error at or near "DELETE"). This is my first time ever using recursive and I must be missing something. Any help is appreciated.</p>