Expression Web中的查询语句

时间:2011-12-19 13:59:52

标签: sql-server-2008 microsoft-expression-web

主席先生,Expression Web中的以下声明适用于第一个标准 SELECT COUNT(Rly) AS CR FROM SPAD WHERE Rly='CR'

现在的问题是,如果同一列中需要多个条件,例如Count(Rly) AS ER FROM SPAD WHERE Rly='ER'

需要什么声明? 请帮忙。

1 个答案:

答案 0 :(得分:1)

计算两个值:

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

一次性分开计算:

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