title: Is a IN subquery matching multiple columns possible in JPQL?
body: <p>I have a SQL query I'm trying to convert to JPQL. The query is as follows : </p>
  
  <pre><code>SELECT *
  FROM MyTable
  WHERE (myFirstColumn, mySecondColumn) IN (
      SELECT myFirstColumn, max(mySecondColumn)
      FROM MyTable
      GROUP BY myFirstColumn
  )
  </code></pre>
  
  <p>My conversion attempt is straightforward :</p>
  
  <pre><code>select myObject
  from MyObject as myObject
  where (myObject.myFirstValue, myObject.mySecondValue) in (
      select subMyObject.myFirstValue, max(subMyOject.mySecondValue)
      from MyObject as subMyObject
      group by subMyObject.myFirstValue
  )
  </code></pre>
  
  <p>MyObject is mapped to MyTable (using annotations).</p>
  
  <p>If I understand the JPQL docs on the IN statement (<a href="http://openjpa.apache.org/builds/1.2.3/apache-openjpa/docs/jpa_langref.html#jpa_langref_in" rel="nofollow">http://openjpa.apache.org/builds/1.2.3/apache-openjpa/docs/jpa_langref.html#jpa_langref_in</a>), and I'm really not sure I do, such a direct conversion isn't possible. Is there another way ?  </p>