Advertisement
Guest User

UserRepository

a guest
Jul 21st, 2018
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.48 KB | None | 0 0
  1. package com.package.repository;
  2.  
  3. @Repository
  4. public interface UserRepository extends JpaRepository<User, Long> {
  5.     @Query(value = "SELECT DISTINCT MONTH(created_at) AS numMonth, COUNT(*) AS count " +
  6.             "FROM user WHERE active = 1 AND dtype = 'UserApp' " +
  7.             "AND created_at BETWEEN DATE_ADD(created_at, INTERVAL -6 MONTH) AND created_at " +
  8.             "GROUP BY MONTH(created_at)", nativeQuery = true)
  9.     List<MonthAndCount> getCountDistinctByMonth();
  10. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement