Skip to content

sub query / nested query  #1136

@FirthTuckman

Description

@FirthTuckman

Information

  • Version of Medoo: [2.2]
  • Version of PHP: [8.0]
  • Type of Database: [SQLite, etc.]
  • System: [Linux]

Describe the Problem

Fetched from select() or get() function:

$database->select("account", "user_name", [
"user_id" => $database->select("post", "user_id", ["comments[>]" => 40])
]);
// WHERE user_id IN (2, 51, 321, 3431)

The result of user_id maybe a very large array, for example 5000+, the pdo will report an exception:
PHP message: PHP Fatal error: Uncaught PDOException: SQLSTATE[HY000]: General error: 1 too many SQL variables in ....Medoo.php:...

Is there a way to make the medoo generates a sql conditon for user_id, for example:
// WHERE user_id in (select user_id from post where ... )

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions