You candirectlycan directly query it like: List opportunities = [SELECT OwnerId, Amount, Probability FROM OPPORTUNITY where Amount > 0 and LastModifiedDate < LAST_N_DAYS:7];
List<Opportunity> opportunities = [SELECT OwnerId, Amount, Probability FROM OPPORTUNITY
where Amount > 0 and LastModifiedDate < LAST_N_DAYS:7];
No need to declare variable and its value fisrtfirst,