我检查了$posts\u not \u to \u select as simple array中的数据,其他一切都很好,但显示的错误如下所示:
异常#0(zend#u dbŠu statementŠexception):sqlstate[42000]:语法错误或访问冲突:1064您的sql语法有错误;请查看与mysql服务器版本对应的手册,以了解在“where”附近使用的正确语法 entity_id
不在(从mst\u blog\u store\u post where not stor'第1行选择post\u id,查询为:select*from mst_blog_post_entity
订货人 created_at
描述限制1,其中 entity_id
不在(从mst\u blog\u store\u post中选择post\u id,其中not store\u id=1)
$posts_not_to_selectssql1 = "SELECT post_id FROM mst_blog_store_post WHERE NOT store_id = $storeID";
$posts_not_to_select12 = $connection->fetchAll($posts_not_to_selectssql1);
$posts_not_to_select = array();
foreach ($posts_not_to_select12 as $key => $value){
$posts_not_to_select[$key] = $value['post_id'];
}
"SELECT * FROM `mst_blog_post_entity` ORDER BY `created_at` ASC LIMIT 1 WHERE `entity_id` NOT IN ( '" . implode( "', '" , $posts_not_to_select ) . "' )"
2条答案
按热度按时间au9on6nz1#
只要在phpmyadmin的sql部分运行这个查询,一切都会正常工作。
4c8rllxm2#
ORDER BY
紧随其后WHERE
条款。完整的顺序是:
选择
从
加入
哪里
分组依据
有
订货人[限额]