Reputation: 7605
I have one table ABC
. I am using queries
select count(*) from ABC where COLA=123; //output is 3
select count(*) from ABC WHERE COLA=321; //output is 6
I want both output combined like
| someColumnName |
| 3 |
| 6 |
Is there any way to frame query so that I can achieve this?
Upvotes: 0
Views: 50
Reputation: 13967
Just another option:
SELECT count(*) as SomeColumnName
FROM ABC
WHERE COLA = 123
OR COLA = 321
GROUP BY COlA;
:)
Upvotes: 0
Reputation: 363
Use UNION
between your two queries:
select count(*) as someColumnName from ABC where COLA=123
union
select count(*) from ABC WHERE COLA=321;
Upvotes: 5
Reputation: 35343
use a group by and where clause.
SELECT count(*) as SomeColumnName
FROM ABC
WHERE COLA in (123,321)
GROUP BY ColA
Upvotes: 4