Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Thu, 24 Feb 2011 @ 19:05:00 GMT


     
  <Prev Next>  
<<First
<Prev
Next> Last>>  


Subj:   Recurisve query - Minimum Bookmarks
 
From:   Anomy Anom

<-- Anonymously Posted: Thursday, February 24, 2011 11:26 -->

Hi,

I am looking for query/Algoritham for the below situation Kindly help us

     RPT_ID   Bookmark
        100   A
        100   B
        101   C
        101   D
        102   A
        103   B
        103   C
        103   D

Query: What are the Minimum Bookmarks to choose to represent all the RPT_ID

Ex:

select rpt_id from table where bookmark in ('A','D') should return all distinct rpt_id of table.

In the above example (101,102,103).

I was able to do this by giving rank to each bookmark under rp_id in the ascending order and get the first rank from each RPT_ID then consolidates to pick up distinct. With this logic the Bookmark are 'A','C','A','D' which distincts 'A','C','D' but this is not complete solution and we want the minimum in this case it is is 'A' and 'D'



     
  <Prev Next>  
<<First
<Prev
Next> Last>>  
 
 
 
 
 
 
 
 
  
  Top Home Privacy Feedback  
 
 
Copyright for the TeradataForum (TDATA-L), Manta BlueSky    
Copyright 2016 - All Rights Reserved    
Last Modified: 27 Dec 2016