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

not duplicate

Status
Not open for further replies.

yuchieh

MIS
Joined
Jul 21, 2000
Messages
178
Location
US
I have tables linked for schools - departments - programs.
One school has various departments; one department provides various programs. I made a query to display schools under each program (sort and group by program).

However, there are a few cases, for example, one school with 3 departments, all 3 departments provide the same programA. Therefore, under programA, the school is listed 3 times.

Because they are unique records (because of 3 department_id), "select distinct" doesn't get rid of duplicate schools under one program. What should I do to have the school listed only once under programA?

Thanks.
 
you could use the aggregate function MAX() and then group by the rest of your columns. I started out with nothing, and I still have most of it.
 
Yes, I use group by and got the results I wanted.

Thanks.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top