1
0
forked from PGL/Clyde

added distinct languages to SQL query

This commit is contained in:
Bartha Maxime 2024-04-17 12:41:58 +02:00
parent bdfa2e6389
commit 6116cbdaa4

View File

@ -19,22 +19,22 @@ public interface StatsRepository extends CrudRepository<Research,Long> {
Iterable<Map<String ,Integer>> viewsByTopics(); Iterable<Map<String ,Integer>> viewsByTopics();
@Query("select new map(r.domain as label, count(r.language) as y) from Research r group by r.domain") @Query("select new map(r.domain as label, count(distinct r.language) as y) from Research r group by r.domain")
Iterable<Map<String ,Integer>> languageByTopics(); Iterable<Map<String ,Integer>> languageByTopics();
@Query("select new map(to_char(r.releaseDate,'YYYY') as label, count(r.language) as y) from Research r group by to_char(r.releaseDate,'YYYY')") @Query("select new map(to_char(r.releaseDate,'YYYY') as label, count(distinct r.language) as y) from Research r group by to_char(r.releaseDate,'YYYY')")
Iterable<Map<String ,Integer>> languageByYears(); Iterable<Map<String ,Integer>> languageByYears();
@Query("select new map(to_char(r.releaseDate, 'month') as label, count(r.language) as y) from Research r group by to_char(r.releaseDate, 'month')") @Query("select new map(to_char(r.releaseDate, 'month') as label, count(distinct r.language) as y) from Research r group by to_char(r.releaseDate, 'month')")
Iterable<Map<String ,Integer>> languageByMonths(); Iterable<Map<String ,Integer>> languageByMonths();
@Query("select new map(to_char(r.releaseDate,'YYYY') as label, count(r) as y) from Research r group by to_char(r.releaseDate,'YYYY')") @Query("select new map(to_char(r.releaseDate,'YYYY') as label, count(distinct r) as y) from Research r group by to_char(r.releaseDate,'YYYY')")
Iterable<Map<String ,Integer>> researchesByYears(); Iterable<Map<String ,Integer>> researchesByYears();
@Query("select new map(r.domain as label, count(r) as y) from Research r group by r.domain") @Query("select new map(r.domain as label, count(distinct r) as y) from Research r group by r.domain")
Iterable<Map<String ,Integer>> researchesByTopics(); Iterable<Map<String ,Integer>> researchesByTopics();
@Query("select new map(to_char(r.releaseDate, 'month') as label, count(r) as y) from Research r group by to_char(r.releaseDate, 'month')") @Query("select new map(to_char(r.releaseDate, 'month') as label, count(distinct r) as y) from Research r group by to_char(r.releaseDate, 'month')")
Iterable<Map<String ,Integer>> researchesByMonth(); Iterable<Map<String ,Integer>> researchesByMonth();
} }