I am populating a combo box with a column froma database,
the problem I have is this column has duplicate values. So I get 2 or three of the same values. Is there anyway to eliminate duplicates and only have one of each value in the combobox?
Printable View
I am populating a combo box with a column froma database,
the problem I have is this column has duplicate values. So I get 2 or three of the same values. Is there anyway to eliminate duplicates and only have one of each value in the combobox?
When you are running the sql statement, use the DISTINCT keyword:
This way will get you all the rows in the column including duplicates:
SELECT myColumn FROM MyTable
This way will only return the rows that are not duplicates:
SELECT DISTINCT myColumn FROM MyTable
Thats exactly what I need! :)