Reputation: 9915
I would like to know if there is any way of counting the number of tuples in a table without actually using the COUNT function?
A B C
XXXX YYYY IIII
XXXX SSSS PPPP
RRRR TTTT FFFF
KKKK AAAA BBBB
If I would like to know how many times XXXX has appeared without using COUNT. Is is possible?
Upvotes: 1
Views: 512
Reputation: 754700
Does this count?
SELECT SUM(1) AS COUNT
FROM SomeTable
WHERE A = 'XXXX';
Or, if 'XXXX' can appear in the other columns:
SELECT SUM(1) AS COUNT
FROM SomeTable
WHERE (A = 'XXXX' OR B = 'XXXX' OR C = 'XXXX');
Upvotes: 3