mardi 8 décembre 2015

SQLite Query with TWO columns referring to ONE

I am stumped. I am trying to write a SQLite query where I have two tables. One table has two columns that both point to the same column in the second table. For example,

Table1
ID     Text     Sender     Recipient    
1     Hi There  1          2 
2     What?     2          1
3     Weirdo!   3          1

Table2
ID    Name     Screenname
1     Me       Me
2     Sally    Sal_gal
3     Bob      Bob

I am trying to write the query where I would get the following results since both the Sender and Recipient from Table1 point to the ID in Table2.

Results
ID       Text       Sender       Recipient
1       Hi There    Me           Sally
2       What?       Sally        Me
3       Weirdo      Bob          Me 

Aucun commentaire:

Enregistrer un commentaire