Access SQL - Achieving result using only one query

I have a simple table called Animals.

AnimalType , Number_on_Farms

Cat , 1
Dog , 4
Cat, 3
Pig , 5

I want a SQL Query which will show a SINGLE field row output of the total of "Cats" and "Dogs" only.
Output should simply be;
8

My problem is that I find I need to do a second query in order to get a single row output - otherwise I end up with a total for cats and a separate row for dogs.  I just want one row output.
Patrick O'DeaAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

PatHartmanCommented:
Uncheck the box that shows AnimalType.  The SQL should look like:

Select "Cats and Dogs" As SelectCriteria, Count(*) As AnimalCount
From yourtable
Where AnimalType In("Cats", "Dogs");

Notice that AnimalType is not included in the select clause but I did include a dummy column so you would have a meaningful label.
Dale FyeOwner, Developing Solutions LLCCommented:
Actually, I think that should be:

SELECT Sum([AnimalCount]) as [Cats and Dogs]
from  yourtable
Where AnimalType In("Cats", "Dogs");
Ryan ChongBusiness Systems Analyst , ex-Senior Application EngineerCommented:
To be more precise if according to table structure and values....

Select Sum(Number_on_Farms) as [Total of Cats and Dogs]
from yourTable
Where AnimalType in ("Cat", "Dog")

Open in new window

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Patrick O'DeaAuthor Commented:
Thanks!
I've got it now!
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.