Hi, everyone, i have some question about sorting in database. How to apply sort by id?
I want to create a search for user’s latest data inputed to database by applying sort by id descending and limit 1 to get the latest.
Thanks in advance, here’s my code:
$qb = $this->db->getQueryBuilder();
$qb->select('*')
->from($this->getTableName())
->where(
$qb->expr()->eq('userid', $qb->createNamedParameter($userid))
);