troubleshooting Question

Selecting Distinct

Avatar of directxBOB
directxBOBFlag for Ireland asked on
SQL
8 Comments1 Solution216 ViewsLast Modified:
I have this statement:

Select j.JobId as ID, r.run as [Name], j.Route as Parent from jobs as j, run as r where r.runid = j.run

Which gives me:

63      D1      1
58      D1      1
64      D1      1
71      D1      1
57      D1      1
70      D1      1
65      D2      1
66      D2      2
67      D2      5
68      D2      2
69      D2      2
59      D2      1
60      D2      2


What I am looking to have

r.run as [Name] & j.Route as Parent

As being unique.

So for 1 we would only have D1 & D2 appear once. instead of having D1 appear multiple times.

Any ideas on this? I tried to do Distinct but I couldn't get it working correctly.
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 8 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 8 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