Question

  Asked: Oct 15 2007   9:34 PM GMT
  Asked by: Jej1216


Select from table where data row missing


SELECT statement, Outer Join

I have a table with the main fields being BU, ASSET, BOOK
for any BU and ASSET combination, there should be two to four rows of data, with just the BOOK value being different. Data corruption has caused us to find all BU-ASSET combinations missing the value 'AMT' for BOOK. I need to join the table to itself (I think) to do this, but my repeated efforts have failed. If I have BU = 10 and ASSET = 125, I have four rows, with BOOK = 'FED','CORP','AMT','LOCAL' and for BU = 20 and ASSET = 130, I have rows with BOOK = 'CORP','FED'. I want to identify BU/ASSET 20/130 as needing an 'AMT' row but to skip BU/ASSET 10/125 since it has an 'AMT' row. How do I accomplish this?

Subscribe to Alerts! Get questions and answers delivered to your Inbox.


E-mail me updates on this question



   SUBSCRIBE

hidden modal window

Answer Wiki (Improve, edit or add to this answer)


 RATE THIS ANSWER
0
Click to Vote:
  •   0
  •  0



I meant to say Data Corruption has necessitated that we find the above scenario.
  • AddThis Social Bookmark Button

Browse more Questions and Answers on Database and Oracle.

Looking for relevant Database Whitepapers? Visit the SearchOracle.com Research Library.


Discuss This Answer


You must be logged-in to discuss a question. Log-in/Register

Micah5  |   Oct 25 2007  1:08PM GMT

I think this would work:

insert into TABLE
select distinct bu,asset,’AMT’
from table
minus
select bu,asset,book
from table