try (didn't test, so it might not work):select Stuff.StuffName, Item.ItemName
from Relation, Stuff ,Item
where Relation.StuffID = Stuff.StuffID and Item.ItemID = Relation.ItemID
and Stuff.DepartID = 1
from Relation, Stuff ,Item
where Relation.StuffID = Stuff.StuffID and Item.ItemID = Relation.ItemID
and Stuff.DepartID = 1
解决方案 »
- sql语句
- 大家好 请帮我解决下更新问题
- mssql中同一个表两个字段进行比较
- SQL Server 2005 Express怎么连接呀?
- 请问我安装sql后为什么服务器无法启动?
- 批量修改数据库中某个字段中数据的前几位
- 100分求一个字符串处理的存储过程
- 有没有银行系统或电信系统的数据库下载?
- 请求帮助:关于日期格式化
- sql server2014安装的时候出现计数器问题,perflib 2.0 计数器removal失败 命令行C:\windows\system32\unlod
- 关于SQL SERVER中表的关键字的用法的问题
- 紧急!为什么我用存储过程sp_attach_db可以恢复本地数据库,却不能恢复“外来”数据库?
left outer join Stuff on [Relation].stuffid=stuff.id
left outer join [item] on [Relation].Itemid=[item].itemid
where [Relation].StuffID in (select StuffID from [Stuff] where DepartID=1)
FROM Stuff a,Item b,Relation c
WHERE c.StuffID IN (select d.StuffID from Stuff d where d.DepartID=1)
AND a.StuffID=c.StuffID
AND b.ItemID=c.ItemID
from relation , stuff , item
where relation.stuffid = stuff.stuffid
and relation.itemID = item.itemId
and stuff.departID = 1 (写SQL的关键是找出MASTER表,在这个例子中,MASTER表是relation)