有什么方法可以让这个SQL语句更快 [英] is there any way i can make this SQL Statement faster

查看:85
本文介绍了有什么方法可以让这个SQL语句更快的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Select itemId,itemName,itemBarcode,created,lastModified from tblItems Where itemId IN (Select itemId from tblRoomItems where roomId IN (Select roomId from tblRoom where officeId="12"));

推荐答案





尝试加入可能对你有所帮助,

Hi,

Try with joining that may help you,
Select itm.itemId,itm.itemName,itm.itemBarcode,itm.created,itm.lastModified from tblItems itm tbl
left outer join tlbRoomItems ritm on itm.itemid = ritm.itemid
left outer join tblRoom rm on rm.roomId = ritm.roomid
where
rm.officeId = "12"



您的查询可能略有不同。尝试上面的查询可以提高性能。



祝你好运。


Your query may be slightly different. try with above query that may improve performance.

best luck.


SELECT  I.itemId,
        I.itemName,
        I.itemBarcode,
        I.created,
        I.lastModified
FROM    tblItems AS I INNER JOIN tblRoomItems AS RI ON I.itemId = RI.itemId
        INNER JOIN tblRoom AS R ON RI.roomId = R.roomId AND R.officeId='12'


这篇关于有什么方法可以让这个SQL语句更快的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆