【问题标题】:mysql select * from table where column a value = column b value laravelmysql select * from table where column a value = column b value laravel
【发布时间】:2017-11-18 10:53:02
【问题描述】:

我正在尝试查询一个表,其中包含名为 completed 的列和名为 follow_ups 的列以及其他列 - 尝试使用 laravel

 select * from table where completed > follow_ups 
 select * from table where completed = follow_ups

使用 laravel 模型即时运行以下内容

 $followUps = TestFollowups::where('follow_ups', '>', 'completed')->get();

我不必使用 laravel 模型系统,我也可以编写手动查询,但不确定查询应该是什么样子。谁能帮忙

【问题讨论】:

标签: php mysql sql database laravel


【解决方案1】:

你可以使用:

whereRaw(select * from table where completed > follow_ups)

【讨论】:

    猜你喜欢
    • 2021-07-21
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-12-02
    • 2015-10-08
    相关资源
    最近更新 更多