title: Grails accessing relationship tables
body: <p>I have one many-to-many relationship in my app which looks like this: class </p>
  
  <pre><code>App {
      String type
      String name
  
      static hasMany = [users: User]
  }
  
  class User {
      String email
      String regid
  
      static belongsTo = App
      static hasMany = [apps:App]
  
  }
  </code></pre>
  
  <p>Now i want to access all Users of an app, by having its id. I prefer using plain SQL as It is working way faster and I database will have ~one million records. So i need a way to access all users of an app where app id in (array of given apps).</p>
  
  <p>What I am trying is doing something like this: </p>
  
  <pre><code>def result = sql.eachRow('SELECT App_Users from App where id in(?)' [id:params.app_checkbox])
  </code></pre>
  
  <p>But this throws me exception as column App_users is not available.</p>
  
  <p>I am trying to do this for 4-5 hours and bearing in mind I am not a web developer, it is already driving me crazy, so could you guys  give me advice, how to access members of many-to-many relationship with sql? </p>