Link to home
Start Free TrialLog in
Avatar of MrBrownUK
MrBrownUK

asked on

Return results with only one item associated

I have a table PROMO which contains the following columns I want to query

promos & items

Promos can have 1 or more items

How do I return promos with only 1 item?

Thank you
ASKER CERTIFIED SOLUTION
Avatar of mbizup
mbizup
Flag of Kazakhstan image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Or... depending on your needs you may be looking for a SUM of items =1:


SELECT Promo, SUM(Items) AS TotItems
FROM YourTable
GROUP BY Promo
HAVING SUM(Items) =1 

Open in new window

Avatar of MrBrownUK
MrBrownUK

ASKER

Hi, Thanks for your help, I had made the changes to my requirement.