Simply Use Inner Join
SELECT A.*, B.UAS
FROM tbl1 AS A JOIN tbl2 AS B ON A.StudentID = B.StudentID AND A.SubjectID = B.SubjectID
SELECT t1.*, t2.UAS
FROM uts AS t1
LEFT JOIN uas AS t2
ON t1.StudentID = t2.StudentID AND t1.SubjectID = t2.SubjectID
You just have to join the two tables on the two common columns.
A JOIN clause is used to combine rows from two or more tables, based on a related column between them.
select t1.*,t2.UAS from table1 t1
inner join table2 t2
ON t1.StudentID = t2.StudentID AND
t1.SubjectID = t2.SubjectID
for details about join you can read some tutorials https://www.w3schools.com/sql/sql_join.asp
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.