Skip to content

Commit

Permalink
fix: 쿼리 오류 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
qormoon committed Jul 14, 2024
1 parent 42d292c commit 611c6f9
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ public interface FlowerRepository extends JpaRepository<Flower, Long> {

List<Flower> findByName(String name);

@Query(value = "SELECT * FROM (SELECT *, ROW_NUMBER() OVER (PARTITION BY name ORDER BY flower_id) as row_num FROM flower) as flowers WHERE row_num = 1 AND name LIKE %:name%", nativeQuery = true)
@Query(value = "SELECT DISTINCT ON (f.name) f.* FROM flower f WHERE f.name LIKE %:name%", nativeQuery = true)
List<Flower> findDistinctByNameContaining(@Param("name") String name);

@Query(value = "SELECT * FROM (SELECT *, ROW_NUMBER() OVER (PARTITION BY name ORDER BY flower_id) as row_num FROM flower) as flowers WHERE row_num = 1", nativeQuery = true)
@Query(value = "SELECT DISTINCT ON (f.name) f.* FROM flower f", nativeQuery = true)
Page<Flower> findDistinctAll(Pageable pageable);
}

0 comments on commit 611c6f9

Please sign in to comment.