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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T14:30:27+00:00 2026-05-22T14:30:27+00:00

2 records in above image are from Db, in above table Constraint are (SID

  • 0

enter image description here

2 records in above image are from Db, in above table Constraint are (SID and LINE_ITEM_ID),
SID and LINE_ITEM_ID both column are used to find a unique record.

My issues :
I am looking for a query it should fetch the recored from DB depending on conditions
if i search for PART_NUMBER = ‘PAU43-IMB-P6’
1. it should fetch one record from DB if search for PART_NUMBER = ‘PAU43-IMB-P6’, no mater to which SID that item belong to if there is only one recored either under SID =1 or SID = 2.
2. it should fetch one record which is under SID = 2 only, from DB on search for PART_NUMBER = ‘PAU43-IMB-P6’, if there are 2 items one in SID=1 and other in SID=2.

i am looking for a query which will search for a given part_number depending on Both SID 1 and 2, and it should return value under SID =2 and it can return value under SID=1 only if the there are no records under SID=2 (query has to withstand a load of Million record search).

Thank you

  • 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-22T14:30:28+00:00Added an answer on May 22, 2026 at 2:30 pm

    Well in my case it worked something like this:

    select LINE_ITEM_ID,SID,price_1,part_number from (
    (select LINE_ITEM_ID,SID,price_1,part_number from Table where SID = 2)
     UNION 
    (select LINE_ITEM_ID,SID,price_1,part_number from Table  SID = 1 and line_item_id NOT IN (select LINE_ITEM_ID,SID,price_1,part_number from Table  SID = 2)))
    

    This query solved my issue……….

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

Sidebar

Related Questions

I'm inserting multiple records into a table A from another table B. Is there
I used this code for inserting records in a person table in my DB
Address records are probably used in most database, but I've seen a number of
I want to find records on a combination of created_on >= some date AND
I need to insert records into a table that has no primary key using
I have a file 'records.txt' which contains over 200,000 records. Each record is on
I have a test form with whitespace above the top image that shouldn't be
I have written a MySQL query (Ad rotate algorithm) to fetch records from multiple
See below image. In the % column I need total % for each of
I have 2 tables, a product table and an image table. Products can have

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.