Oracle Sql: how to substract rows from one table from another only once

Posted by slyder07 on Stack Overflow See other posts from Stack Overflow or by slyder07
Published on 2012-03-24T02:31:13Z Indexed on 2012/03/25 5:29 UTC
Read the original article Hit count: 97

Filed under:
|
|
|

I'm working for a university project, and I have the following question: I have 2 tables in a Oracle DB... I need to select those rows from table1, which are not included in table2... But the main problem is that I need to exclude that rows from table2 wich was selected once... For example:

Table1                       Table2                      ResultTable
id  | Number | Letter        id  | Number | Letter       id  | Number | Letter
_____________________        _____________________       _____________________
1        4        S          1       6        G          2        2        P 
2        2        P          2       8        B          3        5        B
3        5        B          3       4        S          4        4        S
4        4        S          4       1        A          6        2        P
5        1        A          5       1        H
6        2        P          6       2        X

So, how you see it, if one row from Table1 has a "twin" in Table2, they both are excluded. Hope I was explicit enough. Sorry for my bad English. Thanks.

© Stack Overflow or respective owner

Related posts about Oracle

Related posts about table