1
0
mirror of synced 2025-02-23 15:43:14 +03:00
doctrine2/manual/codes/DQL (Doctrine Query Language) - SELECT queries - Aggregate values.php

12 lines
282 B
PHP
Raw Normal View History

2007-04-12 16:43:01 +00:00
<?php
2007-04-12 16:48:37 +00:00
// SELECT u.*, COUNT(p.id) num_posts FROM User u, u.Posts p WHERE u.id = 1 GROUP BY u.id
2007-04-12 16:45:13 +00:00
$query = new Doctrine_Query();
$query->select('u.*, COUNT(p.id) num_posts')
->from('User u, u.Posts p')
->where('u.id = ?', 1)
2007-04-12 16:47:56 +00:00
->groupby('u.id')
->execute();
2007-04-12 16:43:01 +00:00
?>