I have a project management website running on PHP and MySQL. But I am not the person who developed it, which makes it harder for me to figure out what the problem is. So I turned to stack overflow.

When I try to sort a list of objects, MySQL server throws an exception at me, saying:

> 
> "You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'GROUP BY company\_id' at line 10".
> 
> 
> 

So I searched throughout the entire source code for "`GROUP BY company_id`", and found one occurrence, which was not at line 10, first of all, and second, I didn't see anything wrong with it.

That line looked like:

```
$sql .= " GROUP BY company_id
          ORDER BY $orderby";

$rows = db_loadList( $sql );

```

I have tried researching on this topic, but could not find anything specific.
I know this is really not enough information, but I just want to know in general what could possibly cause this problem and if any of you have ever seen it before.

Any kind of input would be greatly appreciated.
Thanks,

Vlad