Query problem

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

    Query problem

    I have a table containg say subjects with an id field:

    Table subjects:
    id integer primary key
    name varchar(30)
    other fields

    Some subjects may be associated. This is handled by another table,
    containing two fields:

    Table assoc_subjects:
    subject1_id: integer
    subject2_id: integer

    The problem is to construct a query that extracts all subjects associated to
    a given subject.
    Another problem is to extracts all subjects that are not associated to a
    given subject. Note that the associations are not ordered, so I will not
    know if the subject is assigned to the first or the second field in the
    assoc_subjects table


    Cheers,

    RHO



Working...