You need to count the most sold items as you said, but only within orders that contain the existing itemid (this is the part that ensures you're only grabbing products that were purchased along with this product).
SELECT i.id,
i.itemid,
COUNT( o.orderid ) AS qtysold
FROM (
SELECT orderid, itemid
FROM ordertable AS t
WHERE t.itemid = 1000
GROUP BY orderid
) AS t
INNER
JOIN ordertable AS o
ON o.orderid = t.orderid
INNER
JOIN itemstable AS i
ON i.itemid = o.itemid
AND i.itemid != 1000
GROUP BY o.itemid
ORDER BY qtysold DESC
LIMIT 5;
or a faster query:
SELECT i.id,
i.itemid,
COUNT( o.orderid ) AS qtysold
FROM itemstable AS i
INNER
JOIN ordertable AS o
ON o.itemid = i.itemid
INNER
JOIN ordertable AS t
ON o.orderid = t.orderid
AND t.itemid = 1000
WHERE i.itemid != 1000
GROUP BY o.itemid
ORDER BY qtysold DESC
LIMIT 5;
The i.itemid != 1000 ensures that you don't count the current product in your result set as it will be in every order, and the customer is already viewing it anyways.