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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T02:00:15+00:00 2026-05-31T02:00:15+00:00

I have a table A itemid itemname itemgroup 1 item1 group1 2 item2 group1

  • 0

I have a table A

itemid     itemname     itemgroup
  1        item1        group1
  2        item2        group1
  3        item3        group1

and a table B

itemid     itemname     itemgroup     invid
  1        item1        group1          1
  3        item3        group1          1

In my case table B is a subset of table A or table A is a superset of table B (Its a table of items already inventoried). Is there a way to get a list of records of group1 from table A not present in table B? Not sure if there is a set operation to get records from super set not contained in the subset (mutual exclusion)?

Currently I am using the following representational query. Is this the right way of accomplishing this? I am currently working in SQL server, but would appreciate answers pertaining to Oracle and MySQL as well.

SELECT itemid, itemname, itemgroup 
  FROM tableA 
 WHERE itemid NOT IN (SELECT itemid 
                        FROM tableB 
                       WHERE invid = parameter)
  • 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-31T02:00:16+00:00Added an answer on May 31, 2026 at 2:00 am

    I think your query is OK but you could also do:

    SELECT * FROM tableA a
     WHERE NOT EXISTS ( SELECT b.itemid FROM tableB b WHERE b.itemid = a.itemid 
                           AND b.invid = parameter )
    

    You could also do an outer join.

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

Sidebar

Related Questions

We have a table like this (simplified version): Items: Itemid Itemname Itemfatherid itemA theitemA
I have a temporary table that hold all items available #TableA ItemId ItemName ItemVer
I have a table full of items that each have a unique ItemID .
I have a situation where I need to display ItemID and ItemName from Items
I have three tables viz: Person(PersonID(INT), Personname(varchar)) , Items(ItemID(INT), Itemname(varchar)) and PersonItemAssoc(PersonItemAssoc(Int), PersonID(INT), ItemID(INT)).
I have a table called Item with columns ItemID (PK), ItemName, ExpectedSubItems and another
I have items and itemgroup tables in my database: CREATE TABLE [items]( [item_id] [int]
I have two table, one is ItemData(ItemID, ItemName) and other one has few columns.
I have item_Details table with 3 columns named as itemID, itemName, itemValue. I would
Consider these Tables: Table Items: ItemID ItemName ------------------ 1 N1 2 N2 3 N4

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.