All Forums Database
pvichare 3 posts Joined 10/14
20 Feb 2015
Volatile query not working or a way to select a subset of the main query

My question is why doesn't Teradata have a way (or I don't know how to) so that I can execute the top query which has a calculated column and then I can write another select statement to just query that one calculated column along with other variable char columns I need without querying the caluclated column's independent variables. I tried volatile tables did not work. 
And I cannot just select the columns I want as I was told prior by some contributors because the calculated column cannot be queried and made to show just that without showing all of its independent columns too in the view.   
Any expertise would be of great help.
Query I have :-
select p.n_cd,, p.ctry, p.region, h.item_cd, h.rgn_nm, c.yr, c.mo_nbr, nullifzero( p.curr_qty-p.pre_qty+p.canc_qty) as pro_qty
from pci.sum_pit as p
inner join 
pci.region as h
on p.n_cd=h.n_cd
inner join pci.ctry as ctry
on pci.ctry_cd=h.ctry_cd
where p.ctry_cd = 'xyz'
Query I want possibly from the top query:-
select p.n_cd, pro_qty 
from whatever table

ravimans 54 posts Joined 02/14
24 Feb 2015

This should help to get subset of the main query:

sel col1, amt from


sel col1, (col2 * col3) as amt from tbname

) aa;

You must sign in to leave a comment.