您有机会查看文档吗?请参阅下面的链接和代码,它应该会有所帮助。
http://subsonicproject.com/docs/Distinct
[Test]
public void SqlQuery_when_setting_distinct_it_should_set_IsDistinct()
{
SubSonic.SqlQuery query= new
Select(Product.SupplierIDColumn).From<Product>().Distinct();
Assert.IsTrue(query.IsDistinct);
}
[Test]
public void SqlQuery_should_handle_distinct()
{
ProductCollection select = new
Select(Product.SupplierIDColumn).From<Product>().Distinct()
.ExecuteAsCollection<ProductCollection>();
Assert.AreEqual(29, select.Count);
}
[Test]
public void SqlQuery_GetRecordCount_should_handle_distinct()
{
int select = new Select(Product.SupplierIDColumn)
.From<Product>().Distinct()
.GetRecordCount();
Assert.AreEqual(29, select);
}