How do i find the Duplicate Values in One Column in PostgreSQL GraphQL Hasura. i know there is a Groupby in SQL but do i do in this case?
Asked
Active
Viewed 910 times
2 Answers
0
Group By is not currently exposed by default in the generated GraphQL API. You can extend the API using Postgres Views or Functions to achieve the functionality you are looking for

Jesse Carter
- 20,062
- 7
- 64
- 101
0
You can simply create a view and query it like a normal table;
let us assume there's a people table with a first_name column. To find duplicates
create or replace view duplicate_first_names as select p.first_name,
count(p.first_name) from people p group by(p.first_name) having
count(p.first_name) > 1
or if you want to return the entire row of the duplicate column, you can add a sub-query:
create or replace view duplicate_people_first_names as select * from
people p where (select count(*) from people ppl where ppl.first_name =
p.first_name) > 1;

Muluken Getachew
- 858
- 6
- 8