php - MAX_JOIN_SIZE 行; SET SQL_BIG_SELECTS=1 - 脚本在 2 年后停止工作

标签 php mysql select

Exception -> string(69) "SQLSTATE[HY000]: General error: 1193 Unknown system variable 'OPTION'" Exception -> string(202) "SQLSTATE[42000]: Syntax error or
 access violation: 1104 The SELECT would examine more than MAX_JOIN_SIZE rows; check your WHERE and use SET SQL_BIG_SELECTS=1 or SET MAX_JOIN_SIZE=# if 
the SELECT is okay" Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[42000]: Syntax error or access violation: 1104 The SELECT 
would examine more than MAX_JOIN_SIZE rows; check your WHERE and use SET SQL_BIG_SELECTS=1 or SET MAX_JOIN_SIZE=# if the SELECT is okay' in 
/customers/e/3/b/jkr.no/httpd.www/STS/amob/inc/timer.php:295 Stack trace: #0 
/customers/e/3/b/jkr.no/httpd.www/STS/amob/inc/timer.php(295): unknown() #1 /customers/e/3/b/jkr.no/httpd.www/STS/amob/index.php(542): 
include('/customers/e/3/...') #2 {main} thrown in /customers/e/3/b/jkr.no/httpd.www/STS/amob/inc/timer.php on line 295

这个脚本已经运行了 2 年。我在事件表中删除了 2000 多行,也许它太大了?

SQL 问题

$hsql = "SELECT h.ID, h.ukeID, h.normal, h.natt, h.FP, h.HP, h.datumID, h.status, h.orderID, 
h.tilleggID, h.yearID, u.ID as userID, u.level as ulevel, 
u.navn as fnavn, u.etternavn, t.navn as tnavn, o.ID as oID, o.navn as onavn,
 o.pH as opH, o.pB as opB, o.pR as opR, o.pS as opS, o.pP as opP, o.pLE as opLE 
FROM timesheet h LEFT JOIN user u ON u.ID = h.userID LEFT JOIN orders o ON
 o.ordernr = h.orderID LEFT JOIN tillegg t ON t.tilleggnr = h.tilleggID AND 
t.orderID = o.ID".$hsql.$sstr.$yearID."  ORDER BY userID ASC, yearID DESC, ukeID DESC, datumID DESC";

第 295 行

foreach($hstmt as $hrow) {

最佳答案

已切换

SET OPTION SQL_BIG_SELECTS=1

SET SESSION SQL_BIG_SELECTS=1

现在可以了!

关于php - MAX_JOIN_SIZE 行; SET SQL_BIG_SELECTS=1 - 脚本在 2 年后停止工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44096131/

相关文章:

AngularJS。多选 JQuery 插件

r - 在 R 中的 select 操作符中使用 %in%

php - 如何使用 Eloquent 选择聚合

php - 想要在php中下载excel文件时显示进度条

php - Nifty 指数价格的 20 周期移动平均线计算

php - MySQL访问被拒绝错误但一切正确!

php - 从数据库获取数据并与用户输入进行比较

javascript - 将复选框限制为 2,但移动选择而不是阻止它

php - 即时重新定义 PHP 类函数?

php - 在 phpMyAdmin 中,在 _users 结构中创建新列会导致错误 #1067