我有一个名为Game的mysql表,它有两列,Name和Score。我想只选择分数至少为100且至少两次的名字。在下面的例子中,Ron和Mary将被选中。我不知道如何为此编写select语句。
游戏桌
答案 0 :(得分:3)
将public static string RemoveWhiteSpaceFromStylesheets(string body)
{
body = Regex.Replace(body, @"[a-zA-Z]+#", "#");
body = Regex.Replace(body, @"[\n\r]+\s*", string.Empty);
body = Regex.Replace(body, @"\s+", " ");
body = Regex.Replace(body, @"\s?([:,;{}])\s?", "$1");
body = body.Replace(";}", "}");
body = Regex.Replace(body, @"([\s:]0)(px|pt|%|em)", "$1");
// Remove comments from CSS
body = Regex.Replace(body, @"/\*[\d\D]*?\*/", string.Empty);
return body;
}
与GROUP BY
子句一起使用:
HAVING
SELECT Name
FROM mytable
GROUP BY Name
HAVING COUNT(CASE WHEN Score >= 100 THEN 1 END) >= 2
子句检查HAVING
个群组,至少有两个记录Name
。