我有两个表,除了 1 之外,它们具有相同的列。例如:
Table1 (column names): Student | Course | Exam1 | Exam2
Table2 (column names): Student | Course | Exam3 | FinalExam
我想将这两个表结合起来得到:
Table: Student | Course | Exam1 | Exam2 | FinalExam
我有以下几点:
Select
student,
course,
Exam1,
Exam2
From Table1
Select
student,
course,
Exam3,
FinalExam
From Table2
Select
student,
course,
Coalesce( t1.Exam1, 0) as Exam1
Coalesce( t1.Exam2, 0) as Exam2
Coalesce( t2.Exam3, 0) as Exam3
Coalesce( t2.FinalExam, 0) as FinalExam
From Table1 t1, Table2 t2
有没有办法使用内部连接更有效/更简洁地做到这一点?