$query = Doctrine_Query::create() ->from('User u') ->where('u.status = ?', 'active') ->orderBy('u.last_login DESC') ->limit(10); $results = $query->execute();
$query = Doctrine_Query::create() ->from('User u') ->leftJoin('u.Address a') ->where('u.status = ?', 'active') ->orderBy('a.city ASC'); $results = $query->execute();In this example, we join the `User` table with the `Address` table using the `leftJoin` method. We then specify a condition that the `status` column in the `User` table must be equal to 'active'. We order the results by the `city` column in the `Address` table in ascending order. Finally, we execute the query and retrieve the results. Overall, Doctrine_Query is a powerful tool for retrieving data from a database in PHP, and is commonly used in frameworks such as Symfony.