Need Help on Below Senario ?

Database
Enthusiast

Need Help on Below Senario ?

Hi,

I have column in talbe name as basecode. it contains values 01,02,03,...,99. My req is when i select the basecode='03' then it should come records contains basecode '03' and '04' values else basecode(Other than 03 and 04) values in MACRO.

Example :

BaseCode:

------------

01

02

03

04

05

06

07

.

.

.

.

.99

3 REPLIES
Teradata Employee

Re: Need Help on Below Senario ?

Can you share sample input and output you desire?

Enthusiast

Re: Need Help on Below Senario ?

Hi,

Example :

table like this

id                base_code

1                       01

2                       02

3                       03

4                       04 

5                       05

6                       06

7                       07

8                       08

example :

sel * from table where base_code = 03

output :

3   03

4    04

Thanks

Anil

Enthusiast

Re: Need Help on Below Senario ?

sel a.id,a.base_code from (
sel id,base_code,case when base_code in ('03','04') then '03' else '01' end as ind from dbname.tablename ) a where a.ind='03'

Other than this you may have to create a SP.