phpsqlmedoo

Medoo SQL IN or similar functionalty


I have a Type column in my database, which contains the entity type, from a set of defined strings. How can I make a query like:

SELECT * FROM "Table" WHERE "Type" IN ('a','b','c');

The IN condition doesn't seem to be supported by Medoo, and even a WHERE condition like

'OR' => [
    'Type' => 'a',
    'Type' => 'b',
    'Type' => 'c',
]

will not work for the duplicated keys.


Solution

  • IN is supported by Medoo & is used like this:

    $database->select("table", "*", [
        "type" => ['a', 'b', 'c']
      ]
    );
    
    // Its equivalent to : ...WHERE "type" IN ('a','b','c') ...