Multiple Foriegn Keys from One Table linking to single Primary Key in second Table
        Posted  
        
            by 
                croker10
            
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by croker10
        
        
        
        Published on 2010-12-30T21:43:39Z
        Indexed on 
            2010/12/30
            21:54 UTC
        
        
        Read the original article
        Hit count: 267
        
Hi all,
I have a database with three tables, a household table, an adults table and a users table. The Household table contains two foreign keys, iAdult1ID and iAdult2ID. The Users table has a iUserID primary key and the Adult table has a corresponding iUserID foreign key. One of the columns in the Users table is strUsername, an e-mail address.
I am trying to write a query that will allow me to search for an e-mail address for either adult that has a relation to the household. So I have two questions, assuming that all the values are not null, how can I do this?
And two, in reality, iAdult2ID can be null, is it still possible to write a query to do this?
Thanks for your help. Let me know if you need any more information.
© Stack Overflow or respective owner