Skip to content
Advertisement

Customers who’ve ordered one time in the past three years

I’m attempting to retrieve a list of customers who have ordered one time in the past three years. I thought that “HAVING COUNT(INVOICE.INVOICE_NO)=1” would get me there, but I’m still getting multiple invoices from the same customers, so I know they’ve ordered more than once. Thanks in advance for the help!

Advertisement

Answer

Your GROUP BY is causing the problem. Just select information about the individual customer:

I also fixed your JOIN syntax (or lack thereof).

User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement