I have a datatable that has many fields from many event files. I need to be able to select distinct on the time. The datetime field is in this format MM/dd/yyyy HH:mm:ss .. I am trying this:
dpall = RollUpValuesFunctions.jobTableFinalCSVOutput.DefaultView.ToTable();
what I am wondering is if there is a way to apply a constraint on the datetime field to only get a distinct date like MM/dd/yyyy HH:mm?
Each minute has a couple hundred records, but for my purposes I only need one of the records from that minute.
And this is in C#
Given the following data:
the obvoius Linq approach is
but since you asked for a non-linq solution, why not just iterate over each row, get rid of the
secondspart of the time, and use aDataViewto do theDistinctpart:If you don’t want to change your
DataTable, you can copy it before.