This question already has an answer here:
- Doctrine Query Language get Max/Latest Row Per Group 4 answers
when trying make multiple select
$result = $this->qb->select('c.id','c.message','acc.name as chat_from', 'c.chat_to as count')
->addSelect("SELECT * FROM chat ORDER BY date_deliver DESC")
->from($this->table,'c')
->join('c','account','acc', 'c.chat_from = acc.id')
->orderBy('date_sent','DESC')
->groupby('chat_from')
->where('chat_to ='.$id)
->execute();
return $result->fetchAll();
i also tried
$result = $this->qb->select('c.id','c.message','acc.name as chat_from', 'c.chat_to as count')
->from("SELECT * FROM chat ORDER BY date_deliver DESC",'c')
->join('c','account','acc', 'c.chat_from = acc.id')
->orderBy('date_sent','DESC')
->groupby('chat_from')
->where('chat_to ='.$id)
->execute();
return $result->fetchAll();
I want to display the data by group by and then display the data inside the last entry.
i' used DOCTRINE DBAL
please helpme