MySQL 5.7.5+ changed the GROUP BY behavior. So in this and future versions GROUP BY would not work in same way as it used to be before.
So to make GROUP BY feature working like before follow these details:
Note: First of all to follow these steps you must need to have root access to your server.
If you want to disable error sql_mode=only_full_group_by permanently then do those steps:
sudo nano /etc/mysql/my.cnf
- Add this to the end of the file
sql_mode = "STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION"
- sudo service mysql restart to restart MySQL
This will disable ONLY_FULL_GROUP_BY for ALL users
Required steps to perform this:
You should have root access to terminal.
Server: Ubuntu 14
LAMP should be installed.
Run this command: cat /etc/motd.tail
Following query will show a list of the all latest tables which are changed/updated ( by inserting/deleting/updating rows ) recently.
SELECT TABLE_SCHEMA , TABLE_NAME
WHERE UPDATE_TIME IS NOT NULL
UPDATE_TIME > NOW() - INTERVAL 1 DAY
TABLE_SCHEMA = 'Your_Database_Name'
Use following SQL query to duplicate any single row. Use your own field names to make this working in your case.
insert into packages (`field_1`, `field_2`, `field_3`, `field_4`)
select `field_1`, `field_2`, `field_3`, `field_4` from packages where id=1