show only one entry per article suggestions fix #96

This commit is contained in:
Hannes Huber 2020-06-21 00:06:15 +02:00
parent 53cdb20091
commit cd1a8568e6
1 changed files with 1 additions and 1 deletions

View File

@ -29,7 +29,7 @@ public interface ArticleRepository extends JpaRepository<Article, Long> {
@Query("SELECT a FROM CustomerOrderPosition cop JOIN cop.order co JOIN co.customer c JOIN cop.article a ORDER BY co.id DESC")
List<Article> getOrderedArticles();
@Query("SELECT a FROM CustomerOrderPosition cop JOIN cop.order co JOIN co.customer c JOIN cop.article a WHERE c.id = :customerId ORDER BY co.id DESC")
@Query("SELECT DISTINCT a FROM CustomerOrderPosition cop JOIN cop.order co JOIN co.customer c JOIN cop.article a WHERE c.id = :customerId ORDER BY co.id DESC")
List<Article> getOrderedArticles(long customerId);
/***