日期:2014-05-17 浏览次数:20848 次
select distinct(t.area) ,(select count(1) as num from aa s where t.area=s.area) from aa t
------解决方案--------------------
string oraclesql; string sql = "select country,count(*) num from aa where area in({0})"; StringBuilder sb = new StringBuilder(); string[] c = { "延庆县", "怀柔区", "密云县", "昌平区", "顺义区", "平谷区", "门头沟区", "北京市", "通州区", "虎山区", "大兴区" }; foreach (string s in c) { sb.Append(string.Format("'{0}',", s)); } oraclesql = string.Format(sql, sb.ToString().TrimEnd(',')); //用oraclesql在数据库中执行