INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

SQL Help!!!

SQL Help!!!

(OP)
Using Teradata ordered analytical functions , is it possible to get the result set below. If yes, can someone please provide me with some hints or the SQL itself.
Any help with this is much appreciated.

Sample Data :

Col1 Col2

D1   K1
D2   K1
D3   K2
D3   K4
D4   K1
D5   K2

Result set :

Col1 Col2

D1   K1
D3   K2

Explanation : Since K1 is associated with D1, all other associations of K1 should be dropped, similarly since D3 is associated with K2 all other associations of D3 should be dropped.
  

RE: SQL Help!!!

select col1, col2 from foo   qualify  rank() over (partition by col2 order by col1, col2)  =1
order by 1

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close