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

22 lines
592 B
PHP
Raw Normal View History

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