MySQL 5.7.23 Error
-
Hi,
There’s Mysql Errors when i want to show PMPRO members list page :
Expression #3 of SELECT list is not in GROUP BY clause and contains nonaggregated column ‘cnsf_www.mu.id’ which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by for request
SELECT
l.id AS ID,
l.id as id,
mu.id as subscription_id,
l.name,
l.description,
l.expiration_number,
l.expiration_period,
mu.initial_payment,
mu.billing_amount,
mu.cycle_number,
mu.cycle_period,
mu.billing_limit,
mu.trial_amount,
mu.trial_limit,
mu.code_id as code_id,
UNIX_TIMESTAMP(startdate) as startdate,
UNIX_TIMESTAMP(enddate) as enddate
FROM wps_cnsf_pmpro_membership_levels AS l
JOIN wps_cnsf_pmpro_memberships_users AS mu ON (l.id = mu.membership_id)
WHERE mu.user_id = 1 AND mu.status = ‘active’
GROUP BY IDThis error is caused by ONLY_FULL_GROUP_BY sql_mode which is activated by default on Mysql >= 5.7.5.
Info about using GROUP clause with only_full_group_by sql mode can be found here :
https://dev.mysql.com/doc/refman/5.7/en/group-by-handling.htmlThis SQL request is in pmpro/includes/functions.php (function pmpro_getMembershipLevelsForUser).
There is also another request which use GROUP BY sentence and make also a mysql Fatal Error for the same page.
It is in pmpro/adminpages/memberslist.php.My corrections :
I have deleted ‘GROUP BY ID’ from first request on original file :(.
For the second one, it is better thanks to ‘pmpro_members_list_sql’ filter.
I used this filter to delete ‘GROUP BY u.ID’ in sql request.Am i the only one having this trouble with this sql_mode ?
Can you correct those SQL requests ?
Could you please add a filter for the first request, it will be easier if something else happens ?Thanks in advance.
Laurent
- The topic ‘MySQL 5.7.23 Error’ is closed to new replies.