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

Group By

Group By

The way to made a simple group by in ivory just need some easy steps.

Example

require_once('Operations.php');

$ivoryOrm = new Operations();

$arrSelect[] = "COUNT(id)";
$arrSelect[] = "country";

$tables[] = "users";

$groupBy[] = "country";

//the method select creates the query : SELECT COUNT(id),country FROM users GROUP BY country;
$select = $ivoryOrm->select($arrSelect, $tables);
$select = $ivoryOrm->groupBy($select, $groupBy);

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

← UnionHaving →
  • Group By
  • Example
Repository Link
Copyright © 2020 Kevin da Silva