Hello,
My goal is:
search for all customers custID with MORE THAN 3 orders. AND then in the same tblOrderRecords, I'd like query to return the more recently 3 records of each of the customers from the first outputs.
I'm running this query but it returns all records:
thanks
My goal is:
search for all customers custID with MORE THAN 3 orders. AND then in the same tblOrderRecords, I'd like query to return the more recently 3 records of each of the customers from the first outputs.
I'm running this query but it returns all records:
Code:
SELECT orderID, dteDate FROM tblOrderRecords WHERE EXISTS (SELECT custID, COUNT(*) FROM tblOrderRecords WHERE status='1' GROUP BY custID HAVING COUNT(*) > 3) ORDER BY custID DESC
thanks