Hi, We’re using DO managed database for two of our Wordpress sites, one of them shows the following error with debug=true in wp-config.php
WordPress database error: [Expression #1 of ORDER BY clause is not in SELECT list, references column ‘wordpress-programs.wp_posts.post_date’ which is not in SELECT list; this is incompatible with DISTINCT] SELECT DISTINCT YEAR( post_date ) AS year, MONTH( post_date ) AS month FROM wp_posts WHERE post_type = ‘attachment’ ORDER BY post_date DESC
Wordpress 5.2.3. PHP 7.3.9-1+ubuntu18.04.1+deb.sury.org+1, MySQL 8.0.16 - Linux
The other site is just fine, see config below and the content is identical i.e we have similar posts on both
Wordpress 5.2.3 PHP 7.2.19-0ubuntu0.18.04.2, MySQL 8.0.16 - Linux
We’ve tried the fixes for Disable ONLY_FULL_GROUP_BY from the following link but didn’t help. Can you please review and help?
https://stackoverflow.com/questions/23921117/disable-only-full-group-by
Thanks James
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
Hello,
I think recently another person had the same issue. You can have a look at this question here:
https://www.digitalocean.com/community/questions/sql_mode-only_full_group_by?comment=82397
They were able to fix the problem by setting the sql_mode on session as instructed by the DO support team.
Hope that this helps! Regards, bobby
Hi Bobby,
Thanks, that was quick!
I did see this post before posting but please note that I’m not privy to what the DO support guys instructed this user to do, and also just guessing it was similar to - SET SESSION sql_mode=(SELECT REPLACE(@@sql_mode,‘ONLY_FULL_GROUP_BY’,‘’));
Which I tried with no luck
James
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.