This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Select with Distinct in API

Hi,

How would I add a 'Distinct' to the following code, as in 'Select Distinct LastName from Person'.

Dim aQuery As Query = Query.From(Table.Person).Select("Lastname")
Dim iPersons = Session.Source.GetCollection(aQuery)

thanks,

Rob.

Parents
  • This should do the trick.

    Dim aQuery As Query = Query.From(Table.Person).Select(Table.Person.LastName)
    Dim iPersons = Session.Source.GetCollection(Of Person)(aQuery).Distinct(Function(t) t.LastName)

    I saw you used some of the typed entity wrapper goodies so I did this myself as well.

    HTH

Reply
  • This should do the trick.

    Dim aQuery As Query = Query.From(Table.Person).Select(Table.Person.LastName)
    Dim iPersons = Session.Source.GetCollection(Of Person)(aQuery).Distinct(Function(t) t.LastName)

    I saw you used some of the typed entity wrapper goodies so I did this myself as well.

    HTH

Children
No Data