Is it possible to use PostgreSQL-like DISTINCT ON in EJB-QL query?
What i need to do is to fetch from db records that are distinct on 3 of 10 columns.
Is it possible to use PostgreSQL-like DISTINCT ON in EJB-QL query?
What i need to do is to fetch from db records that are distinct on 3 of 10 columns.
Why don't you post your entites?
Imagine there is a Customer who has multiple Reservations. This query will return duplictes if the customer has more than one Reservation:
SELECT c FROM Reservation r, IN(r.customer) c
Using the DISTINCT keyword ensures that each customer is represented once in the results:
SELECT DISTICT c FROM Reservation r, IN(r.customer) c
I hope this helps.