使用mysql严格模式

时间:2016-09-18 17:18:05

标签: php mysql mysql-error-1055

我对mysql 7.0的sql请求有错误 您是否对此要求有所改变?

  

[18-Sep-2016 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();

0 个答案:

没有答案