I have this script for my database that creates both of temp tables correctly but errors out on the line, "or where a.sku_num not in
(select gm_sku2store.sku_num from gm_sku2store
where a.sku_num = gm_sku2store.sku_num);"
...I want it to query the two temp tables and come back with the correct records as well as reference another table for records that aren't there? Anyone?
create table &temp_table1 as
select gm_sku.sku_num, gm_itm.des1, gm_itm.vsn,
gm_itm.ve_cd, gm_itm.div_cd
from gm_sku, gm_itm, gm_inv_loc
where gm_sku.sku_num = gm_inv_loc.sku_num
and gm_sku.itm_cd = gm_itm.itm_cd
and gm_inv_loc.store_cd='0001'
group by gm_sku.sku_num, gm_itm.des1, gm_itm.vsn,
gm_itm.ve_cd, gm_itm.div_cd
having sum(gm_inv_loc.avail_qty) > 0;
create table &temp_table2 as
select sku_num
from gm_sku2store
group by sku_num
having sum(min_qty) < 0;
select a.sku_num, a.des1, a.vsn,
a.ve_cd, a.div_cd
from &temp_table1 a
where exists
(select b.sku_num from &temp_table2 b
where a.sku_num = b.sku_num)
or where a.sku_num not in
(select gm_sku2store.sku_num from gm_sku2store
where a.sku_num = gm_sku2store.sku_num);
(select gm_sku2store.sku_num from gm_sku2store
where a.sku_num = gm_sku2store.sku_num);"
...I want it to query the two temp tables and come back with the correct records as well as reference another table for records that aren't there? Anyone?
create table &temp_table1 as
select gm_sku.sku_num, gm_itm.des1, gm_itm.vsn,
gm_itm.ve_cd, gm_itm.div_cd
from gm_sku, gm_itm, gm_inv_loc
where gm_sku.sku_num = gm_inv_loc.sku_num
and gm_sku.itm_cd = gm_itm.itm_cd
and gm_inv_loc.store_cd='0001'
group by gm_sku.sku_num, gm_itm.des1, gm_itm.vsn,
gm_itm.ve_cd, gm_itm.div_cd
having sum(gm_inv_loc.avail_qty) > 0;
create table &temp_table2 as
select sku_num
from gm_sku2store
group by sku_num
having sum(min_qty) < 0;
select a.sku_num, a.des1, a.vsn,
a.ve_cd, a.div_cd
from &temp_table1 a
where exists
(select b.sku_num from &temp_table2 b
where a.sku_num = b.sku_num)
or where a.sku_num not in
(select gm_sku2store.sku_num from gm_sku2store
where a.sku_num = gm_sku2store.sku_num);