1

I want to compare two columns of medoo rather its values.

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

But getting an error while doing so.Is there any solution??

EvilsEmpire
  • 146
  • 2
  • 13

1 Answers1

2

Check out columns relationship here: 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'
Angolao
  • 986
  • 1
  • 15
  • 27
  • since version 2.1, there is issue with placing quotes. ` "post.restrict[<]account.age"` returns in "`post`.`restrict` < *'* account.age *'* " – Gubberrr Sep 17 '21 at 12:56
  • In this case you can use Medoo::raw instead: `['post.restrict[<] => Medoo::raw('')]` – Gubberrr Sep 17 '21 at 14:57