Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6678559
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T04:15:28+00:00 2026-05-26T04:15:28+00:00

I am doing an except query in SQL like this Q1 EXCEPT Q2 EXCEPT

  • 0

I am doing an except query in SQL like this

Q1 EXCEPT Q2 EXCEPT Q3

Where Q1, Q2 and Q3 are sub-query.
I just want to know what will be its output, (Q1-Q2)-Q3 or Q1-(Q2-Q3)? and if 2nd, how to get 1st one as output?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T04:15:29+00:00Added an answer on May 26, 2026 at 4:15 am

    I don’t have an installation of DB2, but in PostgreSQL, Q1 except Q2 except Q3 appears to be interpolated as (Q1 except Q2) except Q3 (note: generate_series(m,n) is a function found in PostgreSQL that generates a single column of integer values from m to n (where m<n, of course)):

    select generate_series(1,10) except select generate_series(5,15) except select generate_series(10,20);
    
    
     generate_series
    -----------------
                   1
                   2
                   3
                   4
    (4 rows)
    
    select * from (select generate_series(1,10) except select generate_series(5,15))a except select generate_series(10,20);
    
    
     generate_series
    -----------------
                   1
                   2
                   3
                   4
    (4 rows)
    
    select generate_series(1,10) except select * from (select generate_series(5,15) except select generate_series(10,20))a;
    
    
     generate_series
    -----------------
                   1
                   2
                   3
                   4
                  10
    (5 rows)
    

    However, it’s best to use parentheses to make certain that the order of evaluation is how you want it.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I know that I can use Query language to find the record I want.
I want to get a departure and destination suburb in my SQL. SELECT jp.`id`,
My SQL Query below is now Returning the RoomsAvailable field correctly except when theres
I'm doing some experimenting with AJAX in CakePHP and it seems to work except
Doing an ajax get request works as expected using the following code: $.ajax({ type:
Doing the below will reproduce my problem: New WPF Project Add ListView Name the
When doing small icons, header graphics and the like for websites, is it better
I have a basic datatable, it can be completely generic for this example, except
Ok before I start I want to say, I am totally new to this
I want to get the results of a left join between two tables, with

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.