You need to sign in to do that
Don't have an account?
URGENT-----SQL Query on salesforce objects
Hi All,
I have 2 objects.
Contacts
Donations
Donations is the child object and have the foreign key contact id in Donations.
Each contact may donate any number of times.
Contact to Donation have one to many relationship. So one contact has many donations.
I want to pull all contact records who donated for past 5 years from now. such that contact should have atleast one donation in each and every year.
Ex: 2009,2010,2011,2012,2013
I want the contact records who donated atleast once in 2009 and 2010 and 2011 and 2012 and 2013
If contact missed to donate in any one of the year , i dont want that record in my result.
Please help me with sql query.
Its urgent
Thanks
I haven't tested this (and it looks a bit sloppy), but would a query like the following work for you?
Obviously, if this is what you meant, you could clean it up and use a for loop to build the query.
Can you please send me using for loops
Is it an actual date field or just a text field?
It is in date datatype
You're right. You can only do 2 sub-queries per query. My bad.
How about something like this:
I got the answer. We can do this by using group by and having clause.
Once again thanks alot