Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

selecting distinct values - oracle 10 sql syntax

Posted on 2011-03-14
3
Medium Priority
?
251 Views
Last Modified: 2012-08-13
Please see the attachment.

fig 1. Is the current output.
fig 2. is the desired output (displaying the new calculated field FAMILY_NAME)

I need the output to display the distinct source surname and relationship surnames that appear on the same row. for example

- source id 121572 (RUTTA) has 5 relations with the surnames of either RUTTA and HUGHES - therefore the family name(s) is HUGHES/ RUTTA.
- source id 171554 (WORTHINGTON) does not have any relations so the family name is just WORTHINGTON.
- source id 185080 (HAIGH) has 2 relations with the surnames HAIGH and WEBB therefore the family name is HAIGH/ WEBB

If there are different surname for the family (as per example 1 and 3) the family names should appear in alphabetical order.

any help is appreciated





rel-example.xls
0
Comment
Question by:tonMachine100
  • 2
2 Comments
 
LVL 32

Expert Comment

by:awking00
ID: 35130157
See attached.
family-name-query.txt
0
 
LVL 32

Accepted Solution

by:
awking00 earned 2000 total points
ID: 35407820
I feel like I did a lot of work just to have my answer discarded.
0

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

An alternative to the "For XML" way of pivoting and concatenating result sets into strings, and an easy introduction to "common table expressions" (CTEs). Being someone who is always looking for alternatives to "work your data", I came across this …
Recursive SQL is one of the most fascinating and powerful and yet dangerous feature offered in many modern databases today using a Common Table Expression (CTE) first introduced in the ANSI SQL 99 standard. The first implementations of CTE began ap…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an anti-spam), the admin…
Screencast - Getting to Know the Pipeline

879 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question