select str(ProductID), str(CustomerID)
from customerproduct a
where EXISTS
(Select 1
from customerpackproduct b
where a.CustomerID=b.CustomerID
AND a.ProductID=b.ProductID)
order by str(CustomerID)
One more thing ... This will work the fastest if u have indexing On CustomerId and ProductId in customerpackproduct table.




Reply With Quote