我有以下的MSSQL表
Names
sno username firstname
1 jim sam
2 raj ravi
3 lion king
Marks
sno from given
1 raj jim
2 raj lion
3 lion raj
4 lion jim
现在我想显示我的表格,如下所示:
Select [from],
[given]
From Marks
Where [from] = 'raj'
输出表:
from given firstname
raj jim sam
raj lion king
我怎么能搞清楚呢?我无法理解它?
答案 0 :(得分:2)
select marks.from, marks.given, names.fistname
from marks
join names
on marks.given = names.username
where marks.from = 'raj'