php - Select rows that have columns equal values in laravel 5.2 -
i'm new user of laravel 5.2
for example have data rows this:
mytable ------------------------------- url | ip ------------------------------- google.com | 11.44.180.149 <----- msn.com | 11.44.180.149 google.com | 11.44.180.149 <----- yahoo.com | 11.44.180.149 google.com | 11.44.180.149 <-----
i want select rows 2 or 3 columns value equal , delete
rows equal it's more one
for example convert this:
mytable ------------------------------- url | ip ------------------------------- google.com | 11.44.180.149 <----- msn.com | 11.44.180.149 yahoo.com | 11.44.180.149
guys i'm sorry because can't speak english well.
thank you
you can use groupby()
method eloquent:
mytable::groupby('ip')->get();
or query builder:
db::table('mytable')->groupby('ip')->get();
Comments
Post a Comment