Ivory ORM Docs

Ivory ORM Docs

  • Docs

›SQL Syntax

SQL Syntax

  • First-Steps
  • Select
  • Select Distinct
  • Where
  • And, Or and Not
  • Order By
  • Insert
  • Update
  • Delete
  • Min and Max
  • Count, Avg and Sum
  • Like
  • In
  • Between
  • Alias
  • Joins
  • Union
  • Group By
  • Having
  • Exists
  • Any & All
  • Procedures

In

In

The steps to use the sql IN property with a where condition using ivory just involves a few properties more.

Example

//import the ivory class
require_once('Operations.php');

//the instance of the ivory
$ivoryOrm = new Operations();

$arrSelect[] = "name";
$arrSelect[] = "email";

$inSelect[] = "Jon"
$inSelect[] = "James"
$inSelect[] = "Jasmine"

$tables[] = "users";

$arrWhere[] = [
    "propName" => "name",
    "fieldValue" => "",
    "isIn" => $inSelect,
];

//the method select creates the query : SELECT name,email FROM users WHERE name IN ('Jon', 'James', 'Jasmine');
$select = $ivoryOrm->select($arrSelect, $tables);
$selectWhere = $ivoryOrm->where($select, $arrWhere);

//the method runQuery is responsible to literally run your query into the database;
$result = $ivoryOrm->runQuery($selectWhere);

Example SELECT IN

//import the ivory class
require_once('Operations.php');

//the instance of the ivory
$ivoryOrm = new Operations();

$arrSelect[] = "name";
$arrSelect[] = "email";

$inSelect[] = "name"

$tables[] = "users";

$selectIn = $ivoryOrm->select($inSelect, $tables);

$arrWhere[] = [
    "propName" => "name",
    "fieldValue" => "",
    "isIn" => $selectIn,
];

//the method select creates the query : SELECT name,email FROM users WHERE name IN (SELECT name FROM users);
$select = $ivoryOrm->select($arrSelect, $tables);
$selectWhere = $ivoryOrm->where($select, $arrWhere);

//the method runQuery is responsible to literally run your query into the database;
$result = $ivoryOrm->runQuery($selectWhere);

← LikeBetween →
  • In
  • Example
  • Example SELECT IN
Repository Link
Copyright © 2020 Kevin da Silva