本文介绍了查询从三个表检索数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有3张桌子
1.class-classid,classname
2.medium-mediumid,mediumname
3.fee-feeid,feetype,classid,mediumid
我想检索Feeid,feetype,classname,mediumname
请在sql sever
I Have three tables
1.class-classid,classname
2.medium-mediumid,mediumname
3.fee-feeid,feetype,classid,mediumid
i want retrive the feeid,feetype,classname,mediumname
please give a query for this in sql sever
推荐答案
select feeid, feetype,class.classname, medium.mediumname
from fee
join class on fee.classid = class.classid
join medium on fee.mediumid = medium.mediumid
参考:
http://msdn.microsoft.com/en-us/library/ms191517.aspx [ ^ ]
http://www.sql-tutorial.net/SQL-JOIN.asp [ ^ ]
Ref:
http://msdn.microsoft.com/en-us/library/ms191517.aspx[^]
http://www.sql-tutorial.net/SQL-JOIN.asp[^]
这篇关于查询从三个表检索数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!