title: How to delete rows from a table with multiple select in DB2
body: <p>I want to delete only the rows that the following statement returns, how can I do that?</p>
  
  <pre><code>  select usersernum,username,useremail 
      from core.appuser
     where usersernum in (
                select ch.usersernum
                  from core.appusersession ch
                 where ch.usersernum not in (
                            select usersernum
                              from (
                                         select max(starttime) as maxstarttime
                                              , usersernum
                                           from core.appusersession  vip
                                          where vip.starttime &gt;= '2011-01-01 00:00:00'
                                       group by usersernum
                                   )
                       )
              group by usersernum
           )
  order by useremail
         ;
  </code></pre>