0

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.

ChrisBD
  • 9,104
  • 3
  • 22
  • 35
Sunil
  • 81
  • 3
  • 14

1 Answers1

1

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 
gbn
  • 422,506
  • 82
  • 585
  • 676
  • Thanks for your reply Mr. gbn. Sir, by doing so I got the result as heading TheCount,Rly and the data in below as 2, CR & 2, ER. But my requirement is Rly in header like CR, ER, ECR & the count in below the header respectively. e.g. – Sunil Dec 19 '11 at 14:16