Answer the question
In order to leave comments, you need to log in
How to get duplicates from a table?
The interests tab contains many identical entries:
id | user_id | name
1 | 1 | test
2 | 1 | test
3 | 1 | test
4 | 2 | test2
5 | 2 | test2
How to get id of duplicates using laravel?
Answer the question
In order to leave comments, you need to log in
By user_id and name?
Pull user_id and name pairs
->select(['user_id', 'name'])
->groupBy(['user_id', 'name'])
->havingRaw('count(user_id) > 1')
->havingRaw('count(name) > 1')
->get()
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question