Distinct

edit

Distinct

Distinct is used by appending the "Distinct()" method on a query:[Test] public void SqlQuerywhensettingdistinctitshouldsetIsDistinct() { SubSonic.SqlQuery query= new Select(Product.SupplierIDColumn).From().Distinct(); Assert.IsTrue(query.IsDistinct); } [Test] public void SqlQueryshouldhandledistinct() { ProductCollection select = new Select(Product.SupplierIDColumn).From().Distinct() .ExecuteAsCollection(); Assert.AreEqual(29, select.Count); } [Test] public void SqlQueryGetRecordCountshouldhandledistinct() { int select = new Select(Product.SupplierIDColumn) .From().Distinct() .GetRecordCount(); Assert.AreEqual(29, select); } Hate to say this, but I have seen this misstated MANY times. The SubSonic SqlQuery object does NOT have a Distinct method in it. It NEVER has. Even with the release of 3.x it does not have a Distinct method. The old Query object did but not the SqlQuery object. Unless someone you work with wrote one. Which is easy enough to do. I have done that myself. Download the latest source and you will see, the SqlQuery object does not have this functionality, there are many other short comings of the SqlQuery object that I won't get into, but if you know enough about it, you can write your own methods to overcome its faults.