Вот так попробуй

insert into PC (code, model, speed, ram, hd, cd, price)
select p.model + (select max(code) from PC),
p.model,
(select max(speed) from PC),
(select max(ram) from PC),
(select max(hd) from PC),
(select cast(max(cast(substring(cd, 1, len(cd) - 1) as smallint)) as
varchar(10)) + 'x'
from PC),
(select avg(price) from PC where price is not null)
from Product p
where p.type = 'PC'
and p.model not in(
  select p2.model
  from PC p2
  where p2.model = p.model
)

WBR, Michael Ponomarev

Ответить