Hello Friends,
If you are looking to use conditions in mysql query with query builder in Symfony2. Please review the below code and make the changes accordingly:
$qb = $this->getConn()->createQueryBuilder();
$qb->select("SUM( IF(`pm_status` = 'accepted', 1, 0)) as accepted, SUM( IF(`pm_status` = 'declined', 1, 0)) as declined, SUM( IF(`pm_status` = 'inreview', 1, 0)) as inreview")->from('tbl_paymentmethod');
$data = $qb->execute()->fetchAll();
0 Comment(s)