douxiong0668 2016-09-18 17:18 采纳率: 100%
浏览 150

使用mysql严格模式的SQL请求

I have an error with a sql request with mysql 7.0 Do you have an idea on this request to change?

[18-Sep-2016 13:08:17 America/New_York] PHP Warning: PDOStatement::execute(): SQLSTATE[42000]: Syntax error or access violation: 1055 Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'test.p.products_model' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by in /home/www/clicshopping_test_ui/boutique/includes/ClicShopping/OM/DbStatement.php on line 97

My request about this error

$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条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥20 idea运行测试代码报错问题
    • ¥15 网络监控:网络故障告警通知
    • ¥15 django项目运行报编码错误
    • ¥15 请问这个是什么意思?
    • ¥15 STM32驱动继电器
    • ¥15 Windows server update services
    • ¥15 关于#c语言#的问题:我现在在做一个墨水屏设计,2.9英寸的小屏怎么换4.2英寸大屏
    • ¥15 模糊pid与pid仿真结果几乎一样
    • ¥15 java的GUI的运用
    • ¥15 我想付费需要AKM公司DSP开发资料及相关开发。