tags: Even small sails can be available away mysql sql database java spring
SQL query statistics abnormal
SELECT t.username,
t.police_no,
SUM(t.totalflytime) AS totalTime
FROM trackname t
WHERE t.delete_state = 1 AND t.police_no IS NOT NULL
GROUP BY t.police_no
Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'feidun.t.username' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by
The literal understanding is the limitation of sql_model = only_full_group_by, which causes SQL that can be checked normally in the previous MySQL version.
Reference document:
http://dev.mysql.com/doc/refman/5.7/en/sql-mode.html#sql-mode-setting
The document points out: only_full_group_by settings will not allow query fields to include non -gathering columns
(1) Upgrade MySQL version
(2) Complete the non -gathering column you want to query in Group By, that is, if the column [non -function] in query query in query should be in group by
SQL correct example:
SELECT t.username,
t.police_no,
SUM(t.totalflytime) AS totalTime
FROM test t
WHERE t.delete_state = 1 AND t.police_no IS NOT NULL
GROUP BY t.police_no,t.username
mysql opens only_full_group_by mode. In this mode, using the old version of mysql to get group by group data will report an error, the error is as follows: `Expression #3 of SELECT list is not in GROU...
Baidu found most of the two solutions, generally recommend the following one, I use it and solve the problem. add the following line at the end of mysql my.ini file...
Today, the project changed its system, reinstalled the MySQL database, and the data was reported incorrectly when the function was executed. Because there is no problem before changing the system, che...
problem When deploying a server-deployed server, the original SQL statement has appeared "this is incompatible with sql_mode = only_full_group_by" error. reason After mysql5.7.5, the default...
Talk about conclusions first The root cause of this problem is caused by the rigorous SQL. Because there is no strict restrictions before the 5.7 version, there is no error, but after 5.7, the default...
Is there any way to query the fields that do not need aggregate? For example, many people come up and select * from xxx group by xx; Or add a field that you want to check more Basically, you can repor...
Remember once, when you migrate the service, connect to the new database, the database is also the backup of the previous, found an error: I started thinking that it was wrong when I imported i...
MySQL reasonable set of sql_mode sql model used to solve the following types of problems (1) By setting sql mode, can perform different stringency data check, data preparation of effective protection....
Solution my.cnf adds a piece of data sql_mode=STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION service mysqld restart resta...