Joined: 26 Nov 2002 Posts: 12375 Topics: 75 Location: San Jose
Posted: Thu Mar 08, 2007 2:51 pm Post subject:
wishlister,
You are very poor at explaining as to what you are trying to do. In the link(listing 3) given there are no columns named rate or hrs or the tables HR or MIS. How are we supposed to help you ?
As I mentioned earlier show us the column defintions of tables HR and MIS and also the target table which you are trying to insert these values into.
create type EMP as
(empno char(6),
name varchar(50),
dtype varchar(11))
ref using integer
mode db2sql
create type HR under EMP as
(rate decimal(9,2),
hrs decimal(9,2))
mode db2sql
create type MIS under EMP as
(sal decimal(9,2),
bonus decimal(9,2))
mode db2sql
create table EMP_t of EMP
(ref is OBJID user generated,
EMPNO with options not null)
create table HR_t of HR
under EMP_t
inherit select privileges
create table MIS_t of MIS
under EMP_t
inherit select privileges
create table employees
(empno char(6) not null,
name varchar(50) not null,
dtype varchar(11) not null,
rate decimal(9,2),
hrs decimal(9,2),
sal decimal(9,2),
bonus decimal(9,2),
primary key(empno))
Joined: 26 Nov 2002 Posts: 12375 Topics: 75 Location: San Jose
Posted: Fri Mar 09, 2007 10:31 am Post subject:
wishlister,
You don't need an union to just insert rows from 2 tables into a single table. try this
Code:
INSERT INTO EMPLOYEE (SELECT A.EMPNO
,A.NAME
,A.DTYPE
,A.RATE
,A.HRS
,B.SAL
,B.BONUS
FROM HR_T A
,MIS_T B
WHERE A.EMPNO = B.EMPNO
AND A.NAME = B.NAME);
Please stop creating more topics for the same problem.
All times are GMT - 5 Hours Goto page Previous1, 2
Page 2 of 2
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum