I am not sure this is possible, but I am sure the SQL gurus will know. 



Desired result is a view with the following key fields (other fields included, 
but 

I can handle them)  



Three source tables, T1, T2, T3 



Columns needed in view that I have questions about. 



T1. KeyColumn    - This field common in all three tables 



(T2. ColumnX - T1. ColumnA )   



((T2. ColumnX - T1. ColumnA ) - T3. ColumnY ) 



Now for the tricky part.  Tables 1 and 2 will always have matching 

KeyColumn values, that would return all rows.  I need a UNION 

for table 3 as it will NOT always contain data for each row in tables 

1 and 2 but I need to see ALLl rows, whether table 3 has data or 

not.  Can you do a computed column with a union select? 



Further to complicate matters The view will have 8 columns. 

3 from table 1, 3 from table 2, 1 computed from T1 and T2 

and the final computed from all three as shown above. 



So the union select for table 3 will only have two columns. 

The KeyColumn and the columnY used in the computation. 

It does not have any of the other 6 non-computed columns. 



I can do all the above with projecting temp tables and then 

table updates.  However, this is in a real time app and my 

goal is to have CURRENT data showing in this view 100% of the 

time.  I do not want to have to do continuous drop tables and 

project temp tables if it can be avoided.  



So, is the above view possible? 



Thanks, 

-Bob 




  

 

Reply via email to