[SQL] values in the FROM

Database

[SQL] values in the FROM

Hi,

I can't find how i can do smething like that :

select a.COSGPA, a.LIBGPA
from ( values ( '2010','Banques' ),
( '2020','Sociétés financières' ),
( '2030','Autres banques' )
) as a ( COSGPA, LIBGPA )
;

Is it posible with TERADATA ?

Thanks
1 REPLY
N/A

Re: [SQL] values in the FROM

Hi robirob44,
it's DB2/ANSI SQL syntax, but not implemented in Teradata. Would be nice to have...

You have to rewrite it with UNIONs, but a SELECT in a UNION needs a FROM:

select a.COSGPA, a.LIBGPA
from
(
select * from
(select '2010' as COSGPA,'Banques' as LIBGPA ) dt
union all
select * from
(select '2020' as COSGPA,'Sociétés financières' as LIBGPA ) dt
union all
select * from
(select '2030' as COSGPA,'Autres banques' as LIBGPA) dt
) as a
;

Dieter