Please provide the solution for how to get the values from two table with matching column values,Not with foreiegn key id.
EX:
Tablea
Employee name DEP Grade
Hari Science A
ram Maths B
Tableb
Employee name other Fee Tuition
Hari 1000 200
ram 3000 100
Expected result:
Employee name other Fee Tuition DEP GRADE
Hari 1000 200 science a
ram 3000 100 Maths b
There is no foreign key relationship with both the tables. Only the column values(hari,ram) are matching with both the tables.
You don't need a foreign key in order to perform a join, just matching values:
SELECT a.name, other_fee, tuition, dep, grade
FROM a
JOIN b ON a.name = b.name
You can try with join to fetch the data
SELECT b.name, b.other_fee, b.tuition, a.dep, a.grade
FROM b
LEFT JOIN a ON b.name = a.name
使用以下SQL。
select a.[Employee name],[other Fee],[Tuition],[DEP],[GRADE] from Tablea a join tableb b on a.[Employee name]=b.[Employee name]
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.