Use results of one query in another query

Options
We are an alumni association and we have memberships available to the students as well as their parents.

I'm trying to make a query that will output parents with one particular membership based on their child who doesn't have any membership at all.

I could swear we've done this in the past but I either can't remember or I'm imaginging things.

Can I use the output of one query in another? Am I going about this the wrong way?

Thanks in advance.

 

Comments

  • You can merge queries.



     
  • Albert - Not sure how frequently this is used, but you can base a query on another query. Maybe that's what you were remembering?



    It's a bit hidden:
    • Create your 'base query'.
    • Create your second query and in Tools/Query Options, on the Records Processing tab there's a 'Select from query' option.
    • Enter your 'base query' there and it will use records only from those in the base query.











     
  • Thank you for the replies, I will try the merge and the select from query suggestions.

     

     

     

  • Gina; I think we are close with your suggestion. I have a query that looks at the student's memberhsip status and in the output I have the individual relation name I can get the parents name in the output, but when I open that up I'm actually looking at the student's record so when I use that as the base query it doesn't work. Am I missing something? Can I export that to a CSV and use that to base a query on?

    Thank you again for your help.

     
  • Albert Gilligan:

    Gina; I think we are close with your suggestion. I have a query that looks at the student's memberhsip status and in the output I have the individual relation name I can get the parents name in the output, but when I open that up I'm actually looking at the student's record so when I use that as the base query it doesn't work. Am I missing something? Can I export that to a CSV and use that to base a query on?

    Thank you again for your help.

     

    Are the parents a full Constituent or just a non-Constituent Relationship?  You open the student's record because that is the record returned by the Query, the parents just happen to be associated with the student's record.



    If you want to open the parent's record from the Query then you need to build your Query from the other direction ... finding the parents and not the student.  If the parents are always a full Constituent then you should be able to create a Constituent Query.  If the parents might be a non-Constiuent Relationship then you'd need to start with a Relationship Query.  Unfortunately a Relationship Query can't  open the Relationship record directly from the Query by double-clicking on the Query result line (this is a shortcoming of Relationship Queries).



    Also, you can't use a Constituent Query as the "base" query for a Relationship Query or vice versa.  There are some ways around this by running a Report and using the Output Query of the Report as the "base" of another Query (dig through the KB and you should be able to find articles on how that works).

  • You need to flip the thinking.



    I would write a consituent query that looks for parents with that particular membership you mention and additionally use Individual Relationship fields to look for the student/child that is missing the member info.



    That should pull up the list of parents, which is what you are looking for.
  • Christine Cooke:

    You need to flip the thinking.



    I would write a consituent query that looks for parents with that particular membership you mention and additionally use Individual Relationship fields to look for the student/child that is missing the member info.



    That should pull up the list of parents, which is what you are looking for.

    I agree with Christine. If you make the parents the base query, you should be able to accomplish what you are looking for.

Categories