fix join + limit in sql query