0

我对 mysql 7.0 的 sql 请求有一个错误你知道这个请求要改变吗?

[2016 年 9 月 18 日 13:08:17 America/New_York] PHP 警告:PDOStatement::execute(): SQLSTATE[42000]:语法错误或访问冲突:1055 SELECT 列表的表达式 #1 不在 GROUP BY 子句中,并且包含非聚合列“test.p.products_model”,它在功能上不依赖于 GROUP BY 子句中的列;这与第 97 行 /home/www/clicshopping_test_ui/boutique/includes/ClicShopping/OM/DbStatement.php 中的 sql_mode=only_full_group_by 不兼容

我对这个错误的要求

$QuppliersProducts1 = $OSCOM_Db->prepare('
        select  p.products_model,s.suppliers_id, 
                sum(op.products_quantity) as sum_qty,    
                s.suppliers_name,op.products_name, 
                opa.products_options, opa.products_options_values   
        from :table_orders_products  op
            left join :table_products p ON op.products_id = p.products_id
            left join :table_suppliers s on p.suppliers_id = s.suppliers_id
            left join :table_orders  o ON op.orders_id = o.orders_id
            left join :table_orders_products_attributes opa ON op.orders_products_id = opa.orders_products_id
        where o.date_purchased between :date_purchased_start  
            and :date_purchased_end
            and s.suppliers_id = :suppliers_id
            and o.orders_status = :orders_status 
            and s.suppliers_id = :suppliers_id
        group by op.products_name, opa.products_options, 
                  opa.products_options_values
        order by p.products_model, op.products_name');

  $QuppliersProducts1->bindInt(':date_purchased_start', (int)$_GET['bDS'] );
  $QuppliersProducts1->bindInt(':date_purchased_end', (int)$_GET['bED'] );
  $QuppliersProducts1->bindInt(':suppliers_id', (int)$_GET['bID'] );
  $QuppliersProducts1->bindInt(':orders_status', (int)$_GET['bOS'] );

  $QuppliersProducts1->execute();
4

0 回答 0