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 7158133
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T13:00:39+00:00 2026-05-28T13:00:39+00:00

My query is not returning the expected amount of records the first part returns

  • 0

My query is not returning the expected amount of records
the first part returns 50.000 records
the second part (below the minus) returns 30.000
so as conclusion my minus should return 20.000 records.
only this is not happening more records are removed 21.000.

— edit —
the count returns more rows that expected, these returned records will in a later step be removed.

Anyone suggestions?

-- select count(*) from (
 SELECT        
    loc.ITEM, 
            loc.loc
            FROM ITEM_LOC loc
    WHERE LOC NOT IN(101,104,107,115,116,117)
    and loc.status = 'A' 
    and primary_supp in (select supplier from item_supplier where supp_discontinue_date >= sysdate) 
   --        );
minus
 --; select count(*) from (
 select distinct item, store from (
  SELECT        
            siv.ITEM,
            sto.store 
            FROM DC_CCN190_SID_VTB siv
            JOIN DC_STORE_RANGING str ON siv.dpac = str.dpac
    join store sto on sto.store_name_secondary = cast(str.loc as varchar2(150 byte))
    where sto.store_close_date >= sysdate 
        union
            SELECT 
    pim.ITEM,
            sto.store
            FROM dc_pim_export_vert PIM
            JOIN DC_STORE_RANGING str ON PIM.dpac = str.dpac
    join store sto on sto.store_name_secondary = cast(str.loc as varchar2(150 byte))
    where PIM.artikel_type_lms = 'D1'
    and sto.store_close_date >= sysdate 
    )

————————————————————————————-

count returns 50.000

  select count(*) from (
 SELECT        
    loc.ITEM, 
            loc.loc
            FROM ITEM_LOC loc
    WHERE LOC NOT IN(101,104,107,115,116,117)
    and loc.status = 'A' 
    and primary_supp in (select supplier from item_supplier where supp_discontinue_date >= sysdate));

count returns 30.000

select count(*) from (
 select distinct item, store from (
  SELECT        
            siv.ITEM,
            sto.store 
            FROM DC_CCN190_SID_VTB siv
            JOIN DC_STORE_RANGING str ON siv.dpac = str.dpac
    join store sto on sto.store_name_secondary = cast(str.loc as varchar2(150 byte))
    where sto.store_close_date >= sysdate 
        union
            SELECT 
    pim.ITEM,
            sto.store
            FROM dc_pim_export_vert PIM
            JOIN DC_STORE_RANGING str ON PIM.dpac = str.dpac
    join store sto on sto.store_name_secondary = cast(str.loc as varchar2(150 byte))
    where PIM.artikel_type_lms = 'D1'
    and sto.store_close_date >= sysdate 
    );

So the minus should return 20.000 right?

  • 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-28T13:00:39+00:00Added an answer on May 28, 2026 at 1:00 pm

    A = 50000. B = 30000. A – B = 21000. What is B – A? I’m expecting 1000. That is, there are 1000 records in B that are not included in A. In a simple case,

    A returns 4 records
    Jim
    Bob
    Mary
    Samantha

    B returns 3 records
    Bob
    Mary
    Josephine

    A – B returns 2 records:
    Jim
    Samantha

    B – A returns 1 record:
    Josephine

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

Sidebar

Related Questions

My LINQ query is not producing the expected output below. Basically, it's the sum
The query below is not returning any results. I have copied it from a
I have this query working but it is not returning back exactly what I
I have the following LINQ expression that's not returning the appropriate response var query
I have a query returning the counts of some data, but I do NOT
My query is not giving proper results when I try to select user records
Why is my query not returning any results? I can run the query SELECT
I have a query which is not working as expected Q1: SELECT id, name
This solution works but performance is lower than expected. A query returning 200K rows
why this simple query not working. I know it was OK before I upgraded

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.