Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Mon, 28 Apr 2003 @ 13:25:37 GMT


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


Subj:   Re: Idea for the implementation of a view needed
 
From:   Geoffrey Rommel

  The problem is to create a quick view, that supply rows from the table member_activity, but doesn't show customer_id for customers from the table customer_restricted.  



Could you possibly use a macro instead of a view? For instance:

REPLACE MACRO member_activity_restricted
 (in_cust_id    /* your data type here */ )
AS
(SELECT
 a.activity,
 CASE WHEN b.cust_id IS NOT NULL THEN 0 ELSE a.cust_id END cust_id
FROM
member_activity a
LEFT JOIN
customer_restricted b
ON a.cust_id = b.cust_id
WHERE a.cust_id = :in_cust_id ;)
;

This only works for one customer ID, of course, but it would probably perform a nested join, which would be very fast, and it would return all rows for that customer. Also, if you execute this a lot, the plastic steps would be cached.



     
  <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