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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T22:57:12+00:00 2026-05-30T22:57:12+00:00

I’m trying to figure out how to work out this query. I have a

  • 0

I’m trying to figure out how to work out this query.

I have a table with multiple columns. Of these columns there are two: colA and colB.

The values in colA and colB in a row will match a different row in the same table, however the actual values in those columns will not be equal.

So for any row:

Col_A | Col_B
val1.0  | val2.0

there will be another row

Col_A | Col_B
val1.1| val2.1

There is an exception where this corresponding row does not exist and it is this row that I need to select.

Any help with the logic around this is greatly appreciated.

I’ve been working with queries of this type

Select * 
from table1 e 
where (e.Col_A = val1.0 and e.Col_B = val2.0)
and (e.Col_A != val1.1 and e.Col_B ! = val2.1)

is this even close? The above strikes me as I write it that if one clause is true then the other must also be true.

Thanks in advance for any help or hints.

Additional info as there were requests for clarification.

What I’m doing is updating a table. This table has a column that will catch and mark any exceptions to the rule I stated above.

The table has about 12 columns and two of these columns can have one of two possible values. Value Types for these two columns are varchar2(30) Normally for any row that has a set of values there will be another row that has the other values. Some of the other unrelated columns can be the same but not necessarily.

The code I have implemented is similar to below and is based on the left join suggestion from KAJ. However it seems to return too many rows in a straight query and in the update it actually updates every row.

Update TableA Set Col_Ex = ('Exception')
Where Exists 
(Select ... Example from Kaj s suggestion below);
  • 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-30T22:57:14+00:00Added an answer on May 30, 2026 at 10:57 pm

    Assuming the following:
    1. The values are fixed (i.e. 1.0 to 1.1 and 2.0 to 2.1)
    2. What you’re looking for is the original row where the corresponding row does not exist
    3. The join between original and corresponding rows is in the columns you haven’t mentioned (I’ve called it key below)
    … then something like the following should work:

    select original.*
    from table original
      left outer join table corresponding on corresponding.key = original.key and corresponding.Col_A = 'val1.1' and corresponding.Col_B = 'val2.1'
    where original.Col_A = 'val1.0'
      and original.Col_B = 'val2.0'
      and corresponding.key is null
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I know there's a lot of other questions out there that deal with this
this is what i have right now Drawing an RSS feed into the php,
I have this code to decode numeric html entities to the UTF8 equivalent character.
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
I am trying to loop through a bunch of documents I have to put
I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example
I'm new to using the Perl treebuilder module for HTML parsing and can't figure

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.