Correlated subquery that contains 'count()'
Posted by:
seeriuss
Date: November 08, 2004 04:44PM
Hi,
I have a customer table called 'CustomerPreferences' that has the total number of products they want daily. Once per day, a PHP page is run that assigns products to our customers and records that in a table called CustomerProducts. It would save the script a good amount of time to not include customers that have already received their total amount.
So I have the following SQL:
SELECT a.CustomerId
FROM CustomerPreferences a
WHERE (
SELECT count(b.BrokerId)
FROM CustomerProducts b
WHERE b.CustomerId = a.CustomerId
) < a.MaxProducts
It gives me a syntax error when I run a query like this. Any ideas?
Subject
Written By
Posted
Correlated subquery that contains 'count()'
November 08, 2004 04:44PM
Sorry, you can't reply to this topic. It has been closed.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion
of Oracle or any other party.