我的问题是这些查询总是在我的本地服务器上运行,但不是在线运行。
SELECT order_number, max(cart_datetime) maxdate, sum(cart_total), cart_u_id
FROM addtocart_2
WHERE cart_u_id ='$_SESSION[UserId]'
GROUP BY cart_datetime desc limit 1
在线服务器显示在下面这一行:
1140 - In aggregated query without GROUP BY, expression #1 of SELECT list contains nonaggregated column 'gloriast_gloria.addtocart_2.order_number'; this is incompatible with sql_mode=only_full_group_by
最佳答案
在 MYSQL 引发的文本异常中你有答案:-)
this is incompatible with sql_mode=only_full_group_by
在您的本地数据库中,您设置了不同的模式。请参阅 MySQL 文档来更改: https://dev.mysql.com/doc/refman/8.0/en/group-by-handling.html https://dev.mysql.com/doc/refman/8.0/en/sql-mode.html
关于php - 我的数据未在数据库中获取,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51318663/