troubleshooting Question

Getting the correct group by

Avatar of tsniff
tsniffFlag for United States of America asked on
Microsoft SQL Server 2005
6 Comments1 Solution183 ViewsLast Modified:
I have the following query:

FROM view_photos_info_including_cat_info AS vp
INNER JOIN  view_photos_main_cats AS vmc ON vmc.cat_id = vp.pc_parent_cat_id
ORDER BY vp.photo_id, vmc.pc_importance

This produce a list that will have multiple entries for photo_id.  Everything is the same but the pc_title is different.  In other words each photo now exists in in multiple categories (pc_title).

 For example:

photo_id, pc_title
1, Events
1, Location
2, Weather
2, News

What I need is unique entries by photo_id.

For example, above would need to become:

1, Events
2, Weather

I just cannot figure out the proper method to get this done.


Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 6 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 6 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros