如何使用medoo框架比较两列而不是值

时间:2017-11-20 12:38:14

标签: php medoo

我想比较两列medoo而不是它的值。

$issues = $database->select("issues","*",[
       "AND" => [
           "projectid" => 1,
           "estimated_hrs[<]" => "timespent"
       ] 
    ]);

但这样做时会出错。是否有任何解决方案?

1 个答案:

答案 0 :(得分:0)

在此处查看列关系:https://medoo.in/api/where

$database->select("post", [
        "[>]account" => ["author_id" => "user_id"],
    ], [
        "post.id",
        "post.content"
    ], [
        "AND" => [
            // Connect two column with condition sign like [=], [>], [<], [!=] as one of array value
            "post.restrict[<]account.age",

            "account.user_name" => "foo",
            "account.email" => "foo@bar.com",
        ]
    ]
);

// WHERE "post"."restrict" < "account"."age" AND "account"."user_name" = 'foo' AND "account"."email" = 'foo@bar.com'