【问题标题】:MySQL - Create Search On custom ColumnMySQL - 在自定义列上创建搜索
【发布时间】:2015-12-14 02:20:04
【问题描述】:

我想像这样运行 MySQL 查询:

 SELECT * FROM `project` WHERE (project.sold_tons + project.recycled_tons + project.recycled_tons + project.donation_tons)*100/project.total_excess_furniture)>90

当我运行它时,我收到如下错误:

#1064 - You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use
near ')>90 ORDER BY `is_archived` DESC 
LIMIT 0, 25' at line 1 

我可以吗? 要么, 有没有其他解决方案可以创建这样的搜索?

如果不是,那么 Laravel 或 MySQL 中的解决方案是什么?

感谢您的帮助..

【问题讨论】:

    标签: mysql sql laravel laravel-5 query-builder


    【解决方案1】:

    你在 where 后面错过了 '('

    试试这个

    SELECT * FROM `project` 
    WHERE ((project.sold_tons + project.recycled_tons + project.recycled_tons + project.donation_tons) *100/project.total_excess_furniture) > 90
    

    【讨论】:

      【解决方案2】:

      project.total_excess_furniture)

      【讨论】:

        猜你喜欢
        • 2015-12-13
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2021-06-05
        • 1970-01-01
        • 2010-12-29
        相关资源
        最近更新 更多