Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to remove duplicate from the dropdown selection

Status
Not open for further replies.

taree

Technical User
May 31, 2008
316
US
I am using the below query in my asp page. my dropdown is populated from this query and the text value that is displayed is ntext from the query. ntext can be the same for every nval value and in my dropdown control there is a duplicate. how can I just only display one ntext value

nval ntext
16 ArdenHills
17 ArdenHills
18 ArdenHills

as you can see I have three ArdenHills in my dropdown control. I would like only to display one....any clue

thanks


SqlStr = "select distinct ds.subarea_id nval, ds.DESCRIPTION ||' - '|| sd.CODE ntext from DISTRICT_SUBAREA ds, sub_district sd where ds.SUB_D_ID = sd.sub_d_id order by ntext";
 
when you use distinct on multiple fields any difference on a subsequent field makes them distinct:
e.g.: 16_ardenhills & 17_ardenhills & 18_ardenhills are distinct. oracle has an "isolate distinct" which isolates distinct portion of the query in parentheses. like this:
select subarea_id , distinct (description), whatever .....
in this case it only looks at description, and not all of them combined.
in which case distinct applies only to description. so
16 ardenhills & 17 ardenhills & 18 ardenhills will result in a single entry of ardenhills. but which number would you want to go with that? 16? 17? 18?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top