Reputation: 681
this is my code:
create table sw_tmp6_gar_crm as
SELECT * FROM(
select as_fid_x_gara.dat_fine_perio as dat_fine_perio,
as_fid_x_gara.cod_soc as cod_soc,
as_fid_x_gara.cod_kto_gar as cod_kto_gar,
as_fid_x_gara.cod_fido as cod_fido,
fid.dat_delib as dat_delib,
fid.dat_scad as dat_scad
from it_soc_x_fv,
as_fid_x_gara ,
rt_fidi
where it_soc_x_fv.flg_tp_soc in ('C','N')
and as_fid_x_gara.dat_fine_perio = 2008-03-06
and as_fid_x_gara.cod_soc = it_soc_x_fv.cod_soc
and rt_fidi.dat_fine_perio = as_fid_x_gara.dat_fine_perio
and rt_fidi.cod_soc = as_fid_x_gara.cod_soc
and rt_fidi.cod_fido_tecnico = as_fid_x_gara.cod_fido
)
;
I receive the following error:
error while compiling statement: failed: parseexception line 10:9 cannot recognize input near 'it_soc_x_fv' ',' 'as_fid_x_gara' in from source
Can you help me in that?
Upvotes: 0
Views: 2443
Reputation: 276
You haven't aliased the tables correctly. In your from statement you haven't mentioned any aliases for tables and in your select columns you are saying fid.dat_delib, fid.dat_scad.
But there is no fid table or alias in your query.
As mentioned earlier, there is no need of sub query, you can directly write a query with out sub query.
Upvotes: 0
Reputation: 2553
You need to give an alias
name for the sub-query. The below one should work.
create table sw_tmp6_gar_crm as
SELECT * FROM(
select as_fid_x_gara.dat_fine_perio as dat_fine_perio,
as_fid_x_gara.cod_soc as cod_soc,
as_fid_x_gara.cod_kto_gar as cod_kto_gar,
as_fid_x_gara.cod_fido as cod_fido,
fid.dat_delib as dat_delib,
fid.dat_scad as dat_scad
from it_soc_x_fv,
as_fid_x_gara ,
rt_fidi
where it_soc_x_fv.flg_tp_soc in ('C','N')
and as_fid_x_gara.dat_fine_perio = 2008-03-06
and as_fid_x_gara.cod_soc = it_soc_x_fv.cod_soc
and rt_fidi.dat_fine_perio = as_fid_x_gara.dat_fine_perio
and rt_fidi.cod_soc = as_fid_x_gara.cod_soc
and rt_fidi.cod_fido_tecnico = as_fid_x_gara.cod_fido
) tmp
;
But as mentioned in the comments, you don't need a sub-query.
Upvotes: 1