I'm trying to create a query like this one : 
 
select commande_id, statut_commande_id, id from historique_commande h
where h.id = (select max(j.id) from historique_commande j where
j.commande_id = h.commande_id group by j.commande_id)
having h.statut_commande_id = 1
;
 
This is to be used as a table_method for a backend list. 
 
I tried this : 
$alias = $q->getRootAlias();
$q->where("$alias.id = (select max(j.id) from historique_commande j
where j.commande_id = $alias.commande_id group by j.commande_id)")
  ->having("$alias.StatutsCommandes.statut_commande_id = ?",
StatutCommande::DEMANDE_DEVIS);

but it fails : error 500, couldn't find class j. 
 
And : 
$alias = $q->getRootAlias();
$q->where("$alias.id = (select max(id) from historique_commande where
commande_id = $alias.commande_id group by commande_id)")
  ->having("$alias.StatutsCommandes.statut_commande_id = ?",
StatutCommande::DEMANDE_DEVIS);

leads to : error 500, unknown colum commande_id. 
 
I'm stuck with this, any help would be greatly appreciated !

-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

You received this message because you are subscribed to the Google
Groups "symfony users" group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to
symfony-users+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en

Reply via email to