Simulating MINUS Operator

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Joe

    #1

    Simulating MINUS Operator

    Hello,

    Hopefully you sql guru's can help me out a bit. :)

    Here is the short example of what I want to accomplish. I wish to
    have the difference between two different select queries.
    So if one query pulls records 1,2,3 and 4 and the second pulls records
    1 and 4 I wish to have only the records 2 and 3. How can I accomplish
    this easily.

    In case that doesn't make sense here is the long version.
    I have two tables that are keyed together through an id field. However
    this is not a one to one relationship, it is a one to many
    relationship. The following is an example of the table

    Table 1 Table 2
    ------------------ ----------------
    ID relid rid vid

    Table 1 and table two are linked through the columns id and rid. There
    can be many links between id and rid so the link is further refined
    through a vid field. What I need is all records in table 1 that will
    not link to table 2 such that relid=rid and vid=46

    I hope this is clear I know it's confusing.

    Joe
Working...