Posted on: 3/18/2014 12:03:00 PM | Views : 256

I want to select distinct values from the first field but then get two fields into a dropdown. 
If I add G1.RiskID the dropdown displays all non-distinct whereas when I do as below I get an error saying RiskID can not be found. 
sSQL = "SELECT DISTINCT G1.RiskCategories from TblRisk As G1 JOIN (SELECT RiskID, RiskCategories from TblRisk) As G2 ON G2.RiskCategories = G1.RiskCategories ORDER BY RiskCategories" dsNames.SelectCommand = sSQL For Each datarow As Data.DataRowView In dsNames.Select(DataSourceSelectArguments.Empty) ddRisk.DataSource = dsNames ddRisk.Items.Add(New ListItem(datarow("RiskCategories"), g2.RiskID)) Next Kind regards

Go to the complete details ...