一条多表查询SQL语句
DataSet ds = Reader.ReturnDataSet("select smalltype,pic1,id from product where smalltype in(select smalltype from type where bigtype='" + Request.QueryString["type"] + "')");
我这条SQL语句想过滤smalltype重复的记录
意思就是一个小类只显示出一条记录
但是
DataSet ds = Reader.ReturnDataSet("select distinct smalltype,pic1,id from product where smalltype in(select smalltype from type where bigtype='" + Request.QueryString["type"] + "')");
似乎不管用.
请问有什么办法解决?
详细代码
public void ReaderImg()
{
data Reader = new data();
DataSet ds = Reader.ReturnDataSet("select smalltype,pic1,id from product where smalltype in(select smalltype from type where bigtype='" + Request.QueryString["type"] + "')");
for (i = 0; i < Convert.ToInt32(ds.Tables[0].Rows.Count.ToString()); i++)
{
hang[i]=ds.Tables[0].Rows[i][1].ToString();
}
}