Click here to Skip to main content
14,333,606 members
Rate this:
Please Sign up or sign in to vote.
See more:
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
Rate this:
Please Sign up or sign in to vote.

Solution 1

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.
   
Rate this:
Please Sign up or sign in to vote.

Solution 2

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'
   

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




CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100