OK, I think I’ve worked it out now. The “DESC” was in the wrong place. Instead of:
$request = ” SELECT $distinct * FROM $wpdb->posts $join WHERE 1=1″.$where.” ORDER BY ID $limits desc”;
it should be….
$request = ” SELECT $distinct * FROM $wpdb->posts $join WHERE 1=1″.$where.” ORDER BY ID DESC $limits”;
Thanks again for helping me out.