0

I am using Spring JPA for show all duplicates in column or only unique values in colums. But I have many columns and need choose the columns. In Postgres I use query:

SELECT * FROM table_test ou WHERE 
(SELECT COUNT(*) FROM table_test inr WHERE inr.col1 = ou.col1) > 1;

Repository:

    @Query(value = FIND_DUPLICATES, nativeQuery = true)
    List<Product> findDuplicates();

But need change name of column (@Param). I tried:

SELECT * FROM table_test ou WHERE 
(SELECT COUNT(*) FROM table_test inr WHERE inr.?1= ou.?1) > 1;

doesn't work.

mszyba
  • 96
  • 1
  • 11

0 Answers0