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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

select distinct doesn't seem to be working...

Status
Not open for further replies.

drummer68

Programmer
Aug 28, 2002
1
US
i have a situation where i need to present a list of people in a table, and avoid duplicate entries.

my current steps are as follows:
//BEGIN
create temporary table tmpnames (name varchar(50));

insert into tmpnames (name) select ar1 from schedules where (ar1 is not null and ar1 <>'');

insert into tmpnames (name) select ar2 from schedules where (ar2 is not null and ar2 <>'');

insert into tmpnames (name) select referee from schedules where (referee is not null and referee <>'');

select distinct(name) from tmpnames where (name is not null and name <>'') group by name asc;
//END

when i run these things, i get a list which includes duplicates. the really odd thing is that some of the duplicates are removed, but not all. for instance, my name appears in the tmpnames table 3 times, but when i run the select statement my name is returned twice.

any ideas or tips would be greatly appreciated

thanks

green
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top