mysql select * from table where column a value = column b value laravel

时间:2017-11-18 01:31:29

标签: php mysql sql database laravel

我试图用一个名为completed的列查询一个表,并在其他列中查询名为follow_ups的列 - 使用laravel im尝试

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

使用laravel模型我运行以下

   <!DOCTYPE html>
    <html lang="en">
    <head>
        <title>Images and Links - Fast Broccoli!</title>
    </head>
    <body>
        <div class="content">
            <h1>Fast Broccoli! - About Us</h1>
            <!--
                Use images and links to build an "About Us" page for Fast Broccoli!,
                the world's first one-hour organic produce delivery service.

            You'll need:
            1. A main image with source: https://upload.wikimedia.org/wikipedia/commons/0/03/Broccoli_and_cross_section_edit.jpg
                  and alt description: Fast Broccoli!'s Logo
            2. A link to the relative path: index.html
                with the text: Return Home
            3. A second link to the absolute path: https://shop.fastbrocolli.com
                The link should target a new browser window.
                The link should contain an image
                    with source: images/cabbage.png
                   -->
        </div>
    </body>
    </html>

我不必使用laravels模型系统我也可以编写手动查询但不确定查询应该是什么样子。任何人都可以帮忙吗

1 个答案:

答案 0 :(得分:0)

您可以使用:

whereRaw(select * from table where completed > follow_ups)
相关问题