PS Query & SQL

 View Only
Expand all | Collapse all

UNION ALL

Natalie Maines

Natalie Maines01-28-2025 11:56 AM

  • 1.  UNION ALL

    Posted 01-23-2025 03:02 PM

    I'm loving this group so far!

    So here's my ask--

    we have a fairly complex query that uses a union-- the top query and the unioned query both pull unique data sets. The query is incredibly slow, and our DBA took a look at it and said it will run much faster using UNION ALL. Unfortunately, UNION ALL is not an option with query manager, but I have found some online references to doing this via an expression. 

    Have any of you done this, and if so, can you give some screenshots of how you accomplished this? I'm having a hard time understanding how to put what I've read online into practice.

    Thank you,



    ------------------------------
    Audrey Liddy
    IT Business Analyst
    State of New Mexico
    ------------------------------

    Message from the HEUG Marketplace:
    ------------------------------
    Find, Review, and Engage with Higher Education-focused solution providers, products, and services using the HEUG Marketplace.
    ------------------------------
    Alliance 2026 Registration is Open!


  • 2.  RE: UNION ALL

    Posted 01-23-2025 04:52 PM
    Hi Audrey,

    I share your sentiment about this group!

    I have never attempted to use a UNION ALL in Query Manager, and using it seems to require tricking the query to ignore the UNION using parentheses, which I wouldn't recommend in most cases because you are essentially taking off some of the built-in guard rails that exist in Query Manager.

    The benefit of the UNION ALL vs a UNION is that the former doesn't try to make the results distinct, which is what helps with the speed.

    So, I wonder if a solution would be to review the JOINS in your query to see if you can't tighten them up to get rid of some extra duplicates that might be hiding in there. That way the UNION doesn't have to work as hard to get rid of the dupes?

    I'd be happy to look at the query/SQL if that would be helpful :)

    Jeffrie



    --
    Jeffrie Brooks | BUSINESS SYSTEM ANALYST
    UNIVERSITY OF MICHIGAN | INFORMATION AND TECHNOLOGY SERVICES
    734-647-8763 | jedobr@umich.edu



    Alliance 2026 Registration is Open!


  • 3.  RE: UNION ALL

    Posted 01-24-2025 11:10 AM

    I would probably create a new view within Application designer that does all the joins/ unions, then add that view to the Query Tree security, then write the PSQuery using the new view.



    ------------------------------
    Daron Wild
    Senior PeopleSoft Developer
    University of Cambridge
    ------------------------------

    Message from the HEUG Marketplace:
    ------------------------------
    Find, Review, and Engage with Higher Education-focused solution providers, products, and services using the HEUG Marketplace.
    ------------------------------

    Alliance 2026 Registration is Open!


  • 4.  RE: UNION ALL

    Posted 01-24-2025 01:51 PM

    Hey Audrey - As an alternative to using a Union, or creating a new view, you could also use the Composite Query tool.  This tool allows you to create a single data source, pulled from other 'base' queries built in Query Manager.  It accomplishes many of the things you need to do with a Union, and (in my experience) it runs pretty quickly.

    Here are a couple of notes on Composite Query.

    1. Navigation = Main Menu> Reporting Tools> Composite Query> Composite Query Manager.
    2. You will need to have security for this functionality - we  used the delivered Roles Composite Query Developer or Composite Query User
    3. The learning curve for Composite query is not too steep.  There are a set of little things to know, but those are documented in a variety of presentations and PeopleBooks.
      1. The biggest difference for me is that the regular, 'base' queries cannot have prompts.  You add the prompts at the Composite Query level.  
    4. I like to think of Composite Queries as data sources, similar to what we build with BI Publisher. 

    Good Luck, and I am happy to answer more questions... 



    ------------------------------
    Tom Johnson
    Sr Business Systems Analyst
    Duke University
    tom.johnson@duke.edu
    "None of us is as smart as all of us"
    ------------------------------

    Alliance 2026 Registration is Open!


  • 5.  RE: UNION ALL

    Posted 01-24-2025 03:56 PM

    I use Composite Query and Tom is absolutely correct.  I created a very large one that would always time out on me.  However, as of PeopleTools 8.60, you can now schedule Composite Query:

    In PeopleTools 8.60, PeopleSoft Query introduces the Composite Query Scheduler, which is used to schedule a composite query to run in the PeopleSoft Process Scheduler. 


    You can search for an existing run control ID or create a new run control ID and schedule a composite query using the Schedule Composite Query page, check the status of your request using the Process Monitor link, and view your output using the Report Manager link.

    I can now schedule my Composite Query and not have to worry about it timing out.  So if you run into that issue, you have this option available.



    ------------------------------
    Daniel Labrecque
    Senior 2 Business Systems Analyst/Functional Architect
    University of Nevada, Las Vegas
    ------------------------------

    Message from the HEUG Marketplace:
    ------------------------------
    Find, Review, and Engage with Higher Education-focused solution providers, products, and services using the HEUG Marketplace.
    ------------------------------

    Alliance 2026 Registration is Open!


  • 6.  RE: UNION ALL

    Posted 01-25-2025 07:51 AM

    The PeopleTools 8.6 update for CsQ (Composite Query) was huge, and made the tool much more user friendly. 

     

    A few other notes to add to what Dan and I said below. 

    1. You can create Standard of Left Outer Joins
      1. You can use the left outer join to mimic what a Union would give you in Query Manager
    2. You can create/use aggregate functions within CsQ,
    3. You can create/apply sorting and formatting rules. 
    4. You can rename fields
    5. You can create expressions at the CsQ level.
    6. You can create/use drilling URL expressions
      1. I have not done this yet

     

    Some personal best practices

    1. Pay attention to how you name your 'base' queries.  Use a naming convention that makes them easy to search.
    2. Just like with BI Publisher queries, make sure you rename your base query expressions to something unique. 
      1. I use a convention that identifies the query and field.

                                                                  i.      Expression Name = Q10_CIP_CODE

    1. Moving fields around is a bit of a pain, so try to figure out the order before you start building the CsQ.

     

    It is a great tool.  I wish it could be pushed out for use with PopSelect, in some way. 

     

    tj

     

    Duke University / SISS Office

    tom.johnson@duke.edu

    919-684-1261

     




    Alliance 2026 Registration is Open!


  • 7.  RE: UNION ALL

    Posted 01-25-2025 09:46 AM

    How many people would be interested in a webinar on how to do composite queries?  I've never done one.  I have one connected query, but that's it.  I'd love to learn more about this.

     




    Alliance 2026 Registration is Open!


  • 8.  RE: UNION ALL

    Posted 01-25-2025 04:17 PM
    Dana,

    Great Idea !Count me in since I never get a chance to explore it. 

    Mital Naik
    Director- System
    Division of Enrollment Management
    University of Texas at Arlington 



    Alliance 2026 Registration is Open!


  • 9.  RE: UNION ALL

    Posted 01-25-2025 09:49 PM
    Me too!

    Vic




    Alliance 2026 Registration is Open!


  • 10.  RE: UNION ALL

    Posted 01-26-2025 06:09 AM

    I have used this tool for several projects, and would be happy to do a presentation on what I have learned. 

     

    But, I would need to wait until after the Alliance to do it. (Maybe later March?)

     

    tj

     

    Duke University / SISS Office

    tom.johnson@duke.edu

    919-684-1261

     




    Alliance 2026 Registration is Open!


  • 11.  RE: UNION ALL

    Posted 01-26-2025 08:19 AM

    Tom, let me talk to Dan on Monday and we'll reach out.   Thanks for offering!

     




    Alliance 2026 Registration is Open!


  • 12.  RE: UNION ALL

    Posted 01-26-2025 07:42 AM

    I would be interested in attending a webinar to learn more about this!



    ------------------------------
    Michelle Jackson
    Director of Operations for Financial Aid
    University of Pittsburgh
    ------------------------------

    Message from the HEUG Marketplace:
    ------------------------------
    Find, Review, and Engage with Higher Education-focused solution providers, products, and services using the HEUG Marketplace.
    ------------------------------

    Alliance 2026 Registration is Open!


  • 13.  RE: UNION ALL

    Posted 01-27-2025 03:12 PM
    I'm interested as well! 

    With warm regards,

    Ewa (Eh-va) Mamro


    EWA MAMRO
    Associate Bursar/Associate Director of Student Accounts
    phone: (508) 793-3906
    • The Spring 2025 Bill has been issued and was due by January 1, 2025 unless enrolled in a payment plan.
    • Visit https://www.holycross.edu/bursars-office for Key Dates and How-To Videos.
    • The office is open 8:30 am to 4:30 pm, Monday through Friday.
    • Office location: Student Accounts/Bursar is located in room 159 of O'Kane Hall, which is building 1 on this campus map
    College of the Holy Cross
    One College Street
    Worcester, MA  01610

    This is not a secure email. Please do not send any documents containing personal information such as a social security number, date of birth, financial account information, or driver's license/state issued ID.



    Alliance 2026 Registration is Open!


  • 14.  RE: UNION ALL

    Posted 01-27-2025 09:48 AM

    Hi Dana! Count me in for the Composite queries webinar. 



    ------------------------------
    Kristi Davis
    Financial Management Analyst III
    Duke University Bursar's Office
    Durham, NC
    kristi.davis@duke.edu

    "If we do teamwork like we should, then we all look good!" -Queen Kristi
    ------------------------------

    Alliance 2026 Registration is Open!


  • 15.  RE: UNION ALL

    Posted 01-27-2025 10:44 AM

    Dana, I'd be very interested in attending a webinar. I'd also like to learn about connected queries, if someone could cover that as well.

    Thanks for spearheading this!



    ------------------------------
    Audrey Liddy
    IT Business Analyst
    State of New Mexico
    ------------------------------

    Message from the HEUG Marketplace:
    ------------------------------
    Find, Review, and Engage with Higher Education-focused solution providers, products, and services using the HEUG Marketplace.
    ------------------------------

    Alliance 2026 Registration is Open!


  • 16.  RE: UNION ALL

    Posted 01-28-2025 09:30 AM

    I am interested in the webinar!



    ------------------------------
    Maria Huerta
    Financial Aid Systems Analyst
    Frederick Community College
    ------------------------------

    Message from the HEUG Marketplace:
    ------------------------------
    Find, Review, and Engage with Higher Education-focused solution providers, products, and services using the HEUG Marketplace.
    ------------------------------

    Alliance 2026 Registration is Open!


  • 17.  RE: UNION ALL

    Posted 01-28-2025 09:47 AM

    I would love to be part of the webinar as well!



    ------------------------------
    Michael Hudgins
    IT Support Associate
    Illinois State University
    ------------------------------

    Message from the HEUG Marketplace:
    ------------------------------
    Find, Review, and Engage with Higher Education-focused solution providers, products, and services using the HEUG Marketplace.
    ------------------------------

    Alliance 2026 Registration is Open!


  • 18.  RE: UNION ALL

    Posted 01-28-2025 09:58 AM

    We are planning to schedule something after Alliance.  Either April or May.  As soon as it's scheduled, we'll promote it here first.  Thanks everyone!   I'm excited to learn more about this also!

     




    Alliance 2026 Registration is Open!


  • 19.  RE: UNION ALL

    Posted 01-29-2025 12:12 PM

    I'm interested in webinars that cover Connected Query and Composite Query.

    Love this interest area!



    ------------------------------
    Susan Gutierrez
    FA and SF Functional Analyst
    Sonoma State University
    ------------------------------

    Message from the HEUG Marketplace:
    ------------------------------
    Find, Review, and Engage with Higher Education-focused solution providers, products, and services using the HEUG Marketplace.
    ------------------------------

    Alliance 2026 Registration is Open!


  • 20.  RE: UNION ALL

    Posted 01-28-2025 10:19 AM

    Would love if there was a webinar on this!

     

    Rachael Daniel

    Director, Systems & Data Analysis

    Division of Enrollment Management

    University of Wisconsin-Milwaukee

    414-229-4277

    rdaniel@uwm.edu

    My pronouns are she/her/hers

     




    Alliance 2026 Registration is Open!


  • 21.  RE: UNION ALL

    Posted 01-28-2025 11:56 AM

    I'd be interested as well.

     

     

     

     

    Natalie Maines
    Senior Business Systems Analyst, Data Analytics and Reporting

    Student Information Services and Systems (SISS)

    Duke University

    1121 West Main St., Suite 2200

    Durham, NC 27701

    natalie.maines@duke.edu

    Tel +1.919.684.1263

     

     

     




    Alliance 2026 Registration is Open!


  • 22.  RE: UNION ALL

    Posted 01-27-2025 10:48 AM

    Tom, 

    I have wondered if composite query would work for this. What my query does is pulls all positions. The top level of the query pulls all filled positions, and gives quite a bit of associated data: dept, business unit, emplid, name, pay band, midpoint, pay rate, position start date, etc. The bottom level pulls the same information but for vacant positions. I use expressions for the fields that aren't applicable such as emplid, and name. Do you think this would be possible with composite query?


    Thanks!



    ------------------------------
    Audrey Liddy
    IT Business Analyst
    State of New Mexico
    ------------------------------

    Message from the HEUG Marketplace:
    ------------------------------
    Find, Review, and Engage with Higher Education-focused solution providers, products, and services using the HEUG Marketplace.
    ------------------------------

    Alliance 2026 Registration is Open!


  • 23.  RE: UNION ALL

    Posted 01-27-2025 03:17 PM

    Hey Audrey

    I think it would work.  Since it sounds like both your queries pull in distinct data sets, what I would do is the following:

    1. In Query Manager, create a 'base ' query that encompasses all students that might get pulled in by your Source 1 and Source 2.  This might be a simple query of all active students in ACAD_PROG, or a list of emplids from STUDENT_AID, or whatever.  The point would be to have a query that defines your base group that all your possible students would exist in.  All student returned by queries in Step 2 and 3 should exist in this base query.
    2. In Query Manager, create a 'Source 1' query that is the same as your (existing) upper level query you described. 
    3. In Query Manager, create a 'Source 2' query that is the same as the (existing) lower level query. 
    4. You will now have 3 queries total - Source Base, Source 1 and Source 2. 
    5. In Composite Query, start by adding Source Base query.  (You will be adding the other two queries to this 'base'.)
    6. Add the Source 1 Query, as a standard join to Source Base query
      1. Pull in the fields you need, arrange them in the order you want, etc. 
    7. Add the Source 2 query, as a standard join to the Source Base query
      1. Pull in the fields you need, arrange them in the order you want, etc. 
    8. Add aggregate functions, rename fields, add expressions as needed. 

    I think as a starting strategy, this will work.  Of course, the devil is in the details, so it will probably take a little fiddling around with the data and the various queries to find out what works. 

    If you end up going down the Composite Query road, let us know how it goes!  Good Luck, and don't hesitate to reach out.

    :-) 



    ------------------------------
    Tom Johnson
    Sr Business Systems Analyst
    Duke University
    tom.johnson@duke.edu
    "None of us is as smart as all of us"
    ------------------------------

    Alliance 2026 Registration is Open!


  • 24.  RE: UNION ALL

    Posted 01-27-2025 03:41 PM

    I want to add this to Tom's directions.  You will need to create these queries without prompts before using Composite Query.  The prompts will need to be created within Composite Query itself.



    ------------------------------
    Daniel Labrecque
    Senior 2 Business Systems Analyst/Functional Architect
    University of Nevada, Las Vegas
    ------------------------------

    Message from the HEUG Marketplace:
    ------------------------------
    Find, Review, and Engage with Higher Education-focused solution providers, products, and services using the HEUG Marketplace.
    ------------------------------

    Alliance 2026 Registration is Open!


  • 25.  RE: UNION ALL

    Posted 01-28-2025 06:23 AM

    Dan is totally correct.  Your prompts have to be part of the Composite Query, and cannot exist in the 'base' queries.  (I think I had mentioned that earlier in this thread, but I don't see it now.) 

     

    tj

     

    Duke University / SISS Office

    tom.johnson@duke.edu

    919-684-1261

     




    Alliance 2026 Registration is Open!


  • 26.  RE: UNION ALL

    Posted 01-27-2025 10:44 AM

    Daron,

    This is the solution we have discussed internally, but we're a little short on developers at the moment, so it'll need to wait for a bit.

    Thanks for the input!



    ------------------------------
    Audrey Liddy
    IT Business Analyst
    State of New Mexico
    ------------------------------

    Message from the HEUG Marketplace:
    ------------------------------
    Find, Review, and Engage with Higher Education-focused solution providers, products, and services using the HEUG Marketplace.
    ------------------------------

    Alliance 2026 Registration is Open!