Search code examples
symfony1propel

How to translate this SQL query with propel?


i don't know how to translate this query :

SELECT distinct(id_ville) FROM `point_location`

I try to do it, but it doesn't work :

$c = new Criteria();
$c->add(PointLocationPeer::ID_VILLE, Criteria::DISTINCT);
$c->setDistinct();
$this->villes = PointLocationPeer::doSelect($c);

Solution

  • Try something like this:

    $c = new Criteria();
    $c->addSelectColumn(PointLocationPeer::ID_VILLE);
    $c->setDistinct();
    $this->villes = PointLocationPeer::doSelect($c);