数据提取问题
例:数据表AA,如下
id customer qty year month
1 mac 400 2011 1
2 mac 4800 2011 2
3 mac 10 2011 3
4 mac 85 2011 4
1 oll 400 2011 1
2 oll 4800 2011 2
3 oll 10 2011 3
4 oll 85 2011 4
现在我想要做的是把customer相同的提取出来,我怎么对比customer是否相同
------解决方案--------------------
DataSet set1 = WebData1.dataSet(sql1);
Hashtable ht=new Hashtable();
for (int ii = 0; ii < set1.Tables[0].Rows.Count; ii++)
{
if(ht.ContainKey(et1.Tables[0].Rows[ii]["customer"].ToString()))
{
((ArrayList)ht.Get(et1.Tables[0].Rows[ii]["customer"].ToString())).Add(et1.Tables[0].Rows[ii]);
}
else
{
ArrayList al=new ArrayList();
al.Add(et1.Tables[0].Rows[ii]);
ht.Put(et1.Tables[0].Rows[ii]["customer"].ToString()),al);
}
}
用哈希表实现就行了