vendredi 22 avril 2016

SQL - selecting multiple tables so as to combine multiple tables

I want to use SELECT * from multiple tables table1 and table2 to get the output table which is nothing but table2 data appended to table1. How do I construct the SELECT * FROM statement ?

table1

id  model  datetime     driver   distance
---|-----|------------|--------|---------
1  | S   | 04/03/2009 | john   | 399 
2  | X   | 04/03/2009 | juliet | 244
3  | 3   | 04/03/2009 | borat  | 555

table2

id  model  datetime     driver   distance
---|-----|------------|--------|---------
4  | 3   | 03/03/2009 | john   | 300
5  | X   | 03/03/2009 | juliet | 200

output table

id  model  datetime     driver   distance
---|-----|------------|--------|---------
1  | S   | 04/03/2009 | john   | 399 
2  | X   | 04/03/2009 | juliet | 244
3  | 3   | 04/03/2009 | borat  | 555
4  | 3   | 03/03/2009 | john   | 300
5  | X   | 03/03/2009 | juliet | 200

Aucun commentaire:

Enregistrer un commentaire