First, I’ll describe my table structure a bit. There are two tables, FormField and Field.
A field can be linked to multiple formfields, but a formfield can only contain one field.
So I have this Linq Query:
var fields = from f in Data.Field.All()
join ff in formfields on f.Field_rid equals ff.Field_rid
select new
{
FormField = ff,
Field = f
};
Now, I am needing to put a distinct somewhere in there, but I can’t figure out where. Basically, I don’t want for the same Field to be returned to me more than once(so I never get a duplicate field). Where would I use the distinct function?
Distinctdoesn’t seem to help you if you have multipleformFieldsperfieldand want to receive only distinctfields. But if you can think of some method to select only oneformFieldfrom all field’s formFields then it can be easily done: