Getting Unique entries? I am querying data using the code below. In the database, there are duplicate entries for 'title', how can I get distinct values?

$criteria = craft()-&gt;elements-&gt;getCriteria(ElementType::Entry);
$criteria-&gt;section = 'institutions';
$query = craft()-&gt;elements-&gt;buildElementsQuery($criteria);
//$query-&gt;setDistinct('title');
$query-&gt;order('title asc');

$queryResults = $query-&gt;queryAll();
$institutions = EntryModel::populateModels($queryResults);

return $institutions;
The query returned by buildElementsQuery() is already prepped to fetch unique entries. But it’s possible for two distinct entries to have the same title, which is why it may look like duplicate entries are being returned.

To only fetch entries with unique titles, do this:

$query-&gt;group('content.title');