Click here to Skip to main content
15,917,875 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i have a table ex:

id item descr other
1 a abc d
2 b abc e
3 c def f


now i am trying to put the desc in a drop down list, by doing

SELECT DISTINCT id, descr
FROM tablex

the problem is that i would like that if there are multiple descr it will be shown only once. i thought the distinct would do that but of course the id is not the same so it is not seeing it as the same that's why they are both being displayed. What and how should i do it please?
Posted

SQL
SELECT DISTINCT descr
FROM tablex

You do not need the id when you want to show the descr only.
 
Share this answer
 
Comments
adnama 29-Feb-12 5:19am    
that gives a blank drop down list :/
bluesathish 29-Feb-12 7:13am    
post your question clearly.
may be the easiest thing is to make the final description unique

like

SELECT DISTINCT id, descr + other
FROM tablex


or you can make your distinct and then on the submit event you check if you find only an id, and if not populate a second dropdoen to choose between "d" and "e"
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900