1
0
mirror of synced 2024-12-15 15:46:02 +03:00
doctrine2/manual/codes/Basic Components - Query - ORDER BY - sorting query results.php

22 lines
592 B
PHP

<?php
// find all users, sort by name descending
$coll = $conn->query("FROM User ORDER BY User.name DESC");
// find all users sort by name ascending
$coll = $conn->query("FROM User ORDER BY User.name ASC");
// or
$coll = $conn->query("FROM User ORDER BY User.name");
// find all users and their emails, sort by email address
$coll = $conn->query("FROM User, User.Email ORDER BY User.Email.address");
// find all users and their emails, sort by user name and email address
$coll = $conn->query("FROM User, User.Email ORDER BY User.name, User.Email.address");
?>