title: SQL: ORA-00933 error in select
body: <p>I'm trying to perform a somewhat complex select from 3 tables, all joined by a b_id:</p>
  
  <pre><code>select max(bs.b_id), 
         h.b_type_id, 
         t.name_id 
    from b_state as bs, 
         t_info as t, 
         history as h 
   where bs.b_id = t.b_id 
     and bs.b_id = h.b_id 
     and t.name_id in (???) 
     and bs.is_detached = ? 
   group by h.b_type_id, 
            t.name_id
  </code></pre>
  
  <p>In MySQL it gives exactly what I want, but it seems to fail in PSQL and Oracle, plus execution in Oracle results in: "<code>ORA-00933: SQL command not properly ended</code>" (which usually occurs in INSERT queries as Google suggests).</p>
  
  <p>I suppose there is a DB independent way to do the same. Please advice.</p>