How to select values from two different tables in SQL
SELECT Test1.SurName, Test2.Class, Test2.Medium
FROM Test1
INNER JOIN Test2 ON Test1.RegNo = Test2.RegNo
select
Test1.SurName,
Test2.Class,
Test2.Medium
from Test1
inner join Test2
on Test1.RegNo = Test2.RegNo
And if you want to select your data for a particular RegNo
, just add a WHERE
clause to the end, like so:
select
Test1.SurName,
Test2.Class,
Test2.Medium
from Test1
inner join Test2
on Test1.RegNo = Test2.RegNo
where Test1.RegNo = 123456 -- or whatever value/datatype your RegNo is