fetchAll not showing the first Element

Hello Gibbon-Members,

following line isnt showing the first element. Any idea how to fix this problem?


Thank you in advance!

$teachingDates = ($resultDates->rowCount() > 0)? $resultDates->fetchAll(\PDO::FETCH_GROUP|\PDO::FETCH_UNIQUE) : array();`

Hi ub123,

A FETCH_GROUP + FETCH_UNIQUE will collapse values down based on the first column value (and collapse unique values). This makes the first value after your SELECT become the array key that items are grouped by. If you also want that result to be part of the data set, you could use an alias to return it twice. For example, I might use “SELECT gibbonPersonID as groupBy, gibbonPersonID, etc, etc” to ensure I get the gibbonPersonID value once the rows are grouped.