Skip to content

Instantly share code, notes, and snippets.

@tyx
Created June 10, 2010 09:22
Show Gist options
  • Save tyx/432750 to your computer and use it in GitHub Desktop.
Save tyx/432750 to your computer and use it in GitHub Desktop.
$subsub = $q->createSubQuery()
->addSelect('subp.id')
->addSelect('CONCAT(\',\', GROUP_CONCAT(DISTINCT sph.subject), \',\') as subj')
->from('Place subp')
->innerJoin('subp.Historiques sph')
->andWhere('subp.visit_status LIKE \'%D2\'')
->groupBy('subp.id')
->addHaving('( subj LIKE \'%,10,%\') AND (subj NOT LIKE \'%,11,%\')');
$sub = $q->createSubQuery()->select('sub.id')->from('('.$subsub->getDql().') sub'); // Throws 'Couldn't find class (SELECT' exception , WTF? Just following http://www.symfony-project.org/cookbook/1_2/en/retrieving_data_with_doctrine#chapter_f6fc97d827760d5157133eaf9798ddaf_sub_queries
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment