1
0
mirror of synced 2024-12-13 22:56:04 +03:00
doctrine2/manual/codes/Basic Components - Query - ORDER BY - sorting query results.php

22 lines
607 B
PHP
Raw Normal View History

2006-07-24 01:08:06 +04:00
<?php
// find all users, sort by name descending
$coll = $session->query("FROM User ORDER BY User.name DESC");
// find all users sort by name ascending
$coll = $session->query("FROM User ORDER BY User.name ASC");
// or
$coll = $session->query("FROM User ORDER BY User.name");
// find all users and their emails, sort by email address
$coll = $session->query("FROM User, User.Email ORDER BY User.Email.address");
// find all users and their emails, sort by user name and email address
$coll = $session->query("FROM User, User.Email ORDER BY User.name, User.Email.address");
?>