You need to sign in to do that
Don't have an account?

SOQL Query to retrieve last year records
Hi All,
I have two object. Student__c (Child) and College__c (Parent).
I want to fetch records of college which are not in Student. So, I have written SOQL like this.
List<college__c> colList = [select id, name from college where ID NOT IN (select college__c from student)];
Now, I have to retrieve colleges from last year (2019) and department equals to Physics. If I am moving to 2021 then I want to see only 2020 records.
How can I modify above SOQL for my requirement.
Please help me.
Thanks in Advance.
Regards,
Ramana V
SOQL Query to retrieve last year records
I have two object. Student__c (Child) and College__c (Parent).
I want to fetch records of college which are not in Student. So, I have written SOQL like this.
List<college__c> colList = [select id, name from college where ID NOT IN (select college__c from student)];
Now, I have to retrieve colleges from last year (2019) and department equals to Physics. If I am moving to 2021 then I want to see only 2020 records.
How can I modify above SOQL for my requirement.
Please help me.
Thanks in Advance.
Regards,
Ramana V
SOQL Query to retrieve last year records
Hi Bhupinder,
Thanks for your reply
I have to fetch account ids in opportunity where createddate = last_year and department__c ='Physics' and I need to add this condition to my existing SOQL which stated above