Skip to content

Conversation

@Vendict
Copy link

@Vendict Vendict commented Aug 21, 2021

But on right side use only RAW.

But on right side use only RAW.
@Vendict
Copy link
Author

Vendict commented Aug 22, 2021

But your solution don't solve like this
select * from table1 where id not in (select id2 from table2)

@phpseven
Copy link

My solution can also solve your problem, and it is more

#1003

$this->database->select(
"account",
"user_name",
[
Medoo::raw(" not in (select id2 from table2) "),
'LIMIT' => [20, 100],
"ORDER" => "user_id",
]
);

@Vendict
Copy link
Author

Vendict commented Aug 23, 2021

My solution can also solve your problem, and it is more

[
Medoo::raw(" not in (select id2 from table2) "),

need key on first row of this array:
PHP Fatal error: Uncaught TypeError: preg_match() expects parameter 2 to be string, object given in Medoo.php:859
You tested this ?

Please correct me, but on this :

$a = $database->select("company", '*', [
        'ID'=> Medoo::raw(" not in (select company_id from table2)"),
    ]);

I recive this SQL:

SELECT * FROM "company" WHERE "ID" = not in (select company_id from table2)

@phpseven
Copy link

phpseven commented Aug 23, 2021

My solution can also solve your problem, and it is more

[
Medoo::raw(" not in (select id2 from table2) "),

need key on first row of this array:
PHP Fatal error: Uncaught TypeError: preg_match() expects parameter 2 to be string, object given in Medoo.php:859
You tested this ?

Please correct me, but on this :

$a = $database->select("company", '*', [
        'ID'=> Medoo::raw(" not in (select company_id from table2)"),
    ]);

I recive this SQL:

SELECT * FROM "company" WHERE "ID" = not in (select company_id from table2)

Use the master branch in my repository to modify, and you have to write this

$a = $database->select("company", '*', [ Medoo::raw("<ID> not in (select company_id from table2)"), ]);

@Vendict
Copy link
Author

Vendict commented Aug 23, 2021

Use the master branch in my repository to modify, and you have to write this

thank you, I already used my solution in small project and try to share to another people to help

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

3 participants