This week's book giveaway is in the OCAJP forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide 1Z0-808 and have Jeanne Boyarsky & Scott Selikoff on-line! See this thread for details.
HQL is just like SQL, except you use Class names and attributes names instead of table and field names. So we can't really post an HQL query for you because we don't know your class and attribute names that you have mapped to those tables. But besides the "distinct" in that last query, your HQL will basically looks the exact same, except change the table name to you class name and your fields to the class' attribute.