List recent 25 blogs across the network

You just have to modify your query to get only first 25 matches SELECT * FROM $wpdb->blogs WHERE spam = '0' AND deleted = '0' and archived = '0' and public="1" limit 25.

The result is already order by id what is incremented automatically, you don’t have anything to bother about there.

Also please note, it is not a good practice to do such queries on every request, you should cache them.