Distinct


Distinct is used by appending the "Distinct()" method on a query:

[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);
}