Query statement in Expression Web

164 Views Asked by At

Sir, the following statement in Expression Web is work for count one criteria SELECT COUNT(Rly) AS CR FROM SPAD WHERE Rly='CR'.

Now the issue is that if more than one criteria is required in same column, for example Count(Rly) AS ER FROM SPAD WHERE Rly='ER'

What statement will be required? Please help.

1

There are 1 best solutions below

1
On BEST ANSWER

To count both values:

SELECT COUNT(Rly) AS TheCount FROM SPAD WHERE Rly IN ('CR', 'ER')

To count separately in one go:

SELECT COUNT(Rly) AS TheCount, Rly 
FROM SPAD
WHERE Rly IN ('CR', 'ER')
GROUP BY Rly