Click here to Skip to main content
15,880,796 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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"));
Posted

Hi,

Try with joining that may help you,
SQL
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.
 
Share this answer
 
SQL
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'
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900