How to write a select query for all columns in a join environment but only show a subset

Database

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.

5 REPLIES
Junior Contributor

Re: How to write a select query for all columns in a join environment but only show a subset

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
Enthusiast

Re: How to write a select query for all columns in a join environment but only show a subset

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

Roland Wenzlofsky

Re: How to write a select query for all columns in a join environment but only show a subset

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

Junior Contributor

Re: How to write a select query for all columns in a join environment but only show a subset

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

a.collectibles/p.semiconductor AS ABC
Enthusiast

Re: How to write a select query for all columns in a join environment but only show a subset

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