This is my database table, SqlDataSource SelectCommand of my dropdownlist and text and value field property of my dropdownlist. I want my selected country have all resultsId correspending to it. I mean when i select spain i want to have both 2 and 3 for resultsid. But problem is, in my dropdownlist i have duplicate country texts and i cannot change it.
country resultsId
spain 2
spain 3
china 2
china 4
canada 1
canada 4
england 1
england 3
usa 1
usa 2
SelectCommand="SELECT distinct countries, resultsid FROM countrytable"
DataTextField="country" DataValueField="resultsid"
I tried this SelectCommand:
SelectCommand="SELECT resultsId,(select country, count(*)
from countrytable group by country having count(*) >1) FROM countrytable
But and now, i have this error :
Only one expression can be specified in the select list when the
subquery is not introduced with EXISTS
I am using sql server and asp.net c#