Simon Simon - 7 months ago 25
SQL Question

Search Distinct values in DataTable

I have a datatable that has a few thousand rows, there are three columns and I want to search the one specific column in the datatable to find the Distinct values. I have tried this:

DataRow[] dr = datatable.Select("SELECT DISTINCT Amount ");


Amount is the column name that I am trying to group the values by.

The error I get is:
Syntax error: Missing operand after 'DISTINCT' operator

Thanks

Answer
  DataView view = new DataView(datatable);
  DataTable distinctAmount = view.ToTable(true, "Amount", "xxx","xxxx"...);

enter image description here