Hello Guys我在数据库中相当新。
我有2张桌子
1 Tbl_name
ID - Varchar
Name - Varchar
2 Tbl_ref
ID - Varchar
Fid - Varchar
如果Tbl_name
Fid from Tbl_ref = '111-11'
获取姓名
欢迎任何帮助:)
答案 0 :(得分:2)
无论我从你的问题中理解什么,这都是你正在寻找的......
SELECT N.NAME
FROM Tbl_name N
INNER JOIN Tbl_ref R ON N.ID = R.ID AND FID = '111-11'
我还建议你参考这个链接.. http://www.w3schools.com/sql/
答案 1 :(得分:2)
SELECT N.NAME
FROM Tbl_name N
INNER JOIN Tbl_ref R ON N.ID = R.ID WHERE FID = '111-11';
试试这个
答案 2 :(得分:0)
SELECT Name
FROM Tbl_name, Tbl_ref
WHERE Tbl_name.ID = Tbl_ref.ID
AND Fid = '111-11'