function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
SSebSSeb 

Find product count availability from a custom object

Step 1 - Get ship date and return date from Opportunity -
select  o.Name, o.First_Ship_Date__c, o.Expected_Return_Ship_Date__c
from Opportunity o where id in ( select OpportunityId FROM OpportunityLineItem )

Step 2- Get the min ( count of product ) between the ship date and return date from my custom object where I have the product on hand by date.
Select MIN(K_DS_WIFI_1__c) from Datascan_Product__c where Count_Date__c > 2019-04-01 and Count_Date__c < 2019-04-30


Step3 : Use a trigget to update a field with the value of the min ( count of product)  on the Opportunity line item.

Questions
Is there a way to combine step 1 and step 2 in the same soql.
How to call the soql in the trigger?