0

I am trying to do a query that used to work but I updated to mysql 5.7.

The GROUP by does not work..

           $query = "SELECT * FROM `all_contacts` GROUP BY `email` ORDER BY `id` DESC";
    $prevResult = mysqli_query($con,$query);
    while($row = mysqli_fetch_array($prevResult)){
     echo $row['email'].'<br>';                   
    }

It isnt giving me any results. The connection is good because if I remove GROUP BY it works.

user3783243
  • 5,368
  • 5
  • 22
  • 41
X_JuDaH_X
  • 33
  • 1
  • 7
  • 1
    5.7 changed the behavior for how `group by` works by default. You need to put the column in the `select` list. I'll find a dup that covers it. – user3783243 Jun 05 '19 at 01:37
  • 3
    Possible duplicate of [Error related to only\_full\_group\_by when executing a query in MySql](https://stackoverflow.com/questions/34115174/error-related-to-only-full-group-by-when-executing-a-query-in-mysql) – user3783243 Jun 05 '19 at 01:38

0 Answers0