All Forums Database
pvichare 3 posts Joined 10/14
16 Feb 2015
How to write a select query for all columns in a join environment but only show a subset

Hi All Teradata Experts,
I know this might be a simple task for many but I am trying to write a query where I wil be able to view only the first column (semiconductor) and last column (collectibles) but not the middle ones. How do i script this kind of queries. 
Please assist. 
 

select 

p.semiconductor,

p.software,

p.apple,

p.android,

a.collectibles

from 

cpi.collective as p

inner join

on a.code_id=p.code_id

 

 

Thank you.

dnoeth 4628 posts Joined 11/04
16 Feb 2015

Simply select only those columns you need?

select 
   p.semiconductor,
   a.collectibles
from 
cpi.collective as p
inner join
on a.code_id=p.code_id

 

Dieter

oshun 43 posts Joined 07/10
16 Feb 2015

There is something missing in your query. I cannot see the second table after the "inner join" ...

visit my private blog at http://www.dwhpro.com

pvichare 3 posts Joined 10/14
17 Feb 2015

Hi Dieter,
 
I have some calculated columns which I am looking to see in my view, but because of interdependencies I cannot view a calculated column without having both the columns from two tables. I am sorry I should have mentioned this earlier, but when I tried to just write........
Example
a.collectibles/p.semiconductor = ABC it gives me an error as you know without both independent variables it would not let me just put a calc column in the view.
Please le tme know what your thoughts are on this and really appreciate your expertise.
 
Best,
P

dnoeth 4628 posts Joined 11/04
17 Feb 2015

Of course you can do a calculated column in a view:

a.collectibles/p.semiconductor AS ABC

 

Dieter

ksaikrishna 26 posts Joined 08/11
17 Feb 2015

There is something missing in your query. I cannot see the second table after the "inner join" ...

You must sign in to leave a comment.