quick question here that's in the title. Is there any way to update the relationship record field in apex without looping through that object after querying a list of ids.
Example snippet below that currently is not working:
Opportunity o = [Select Id, lookup__r.field__c, lookup__r.field2__c from Opportunity];
o.lookup__r.field__c = 'test';
o.lookup__r.field2__c ++;
update o;