Fetch duplicate values in a query

Re: Fetch duplicate values in a query

by Davo Smith -
Number of replies: 0
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

Try fetching block_userlist.id as the first field returned, that will make every returned record have a unique first field. I also note you've not put { } around the table names, which you need to do for Moodle to automatically insert the table prefix ("mdl_" by default on new installs).

Alternatively you could use get_recordset_sql - which doesn't create an indexed array, so doesn't need a unique first field.