Iam trying to execute the following mysql query and getting mentioned error.
SELECT * FROM `selector` WHERE `to_id`='44' ORDER BY `time` DESC 
GROUP BY `event_id`, `entity_guid`;
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
event_id,entity_guidLIMIT 0, 25' at line 1
Can anybody help to correct/rewrite this query as I need to order the rows in descending order first time and then eliminate the duplicate entries by grouping event_id and entity_guid
Below is the representation of my SELECTOR table
|------|-------|----------|-------------|-------------|
|fr_id | to_id | event_id | entity_guid | time        |
|------|-------|----------|-------------|-------------|
| 44   | 54    |  4       | 0           | 1531121058  |
|------|-------|----------|-------------|-------------|
| 54   | 44    |  3       | 0           | 1531063718  |
|------|-------|----------|-------------|-------------|
| 54   | 44    |  2       | 609         | 1531063431  |
|------|-------|----------|-------------|-------------|
| 54   | 44    |  1       | 608         | 1530975443  |
|------|-------|----------|-------------|-------------| 
| 150  | 44    |  1       | 608         | 1531542247  |
|------|-------|----------|-------------|-------------|     
The actual result I needed is as follows
|------|-------|----------|-------------|-------------| 
| 150  | 44    |  1       | 608         | 1531542247  |
|------|-------|----------|-------------|-------------|
| 54   | 44    |  3       | 0           | 1531063718  |
|------|-------|----------|-------------|-------------|
| 54   | 44    |  2       | 609         | 1531063431  |
|------|-------|----------|-------------|-------------|   
 
     
    