有一出现,另一个的那一列 就显示空白
create procedure add_table
is
begin
insert into wip_led_opration(operation_id,led_pc_id,led_screen_id)
select operation_id,led_pc_id,led_screen_id from fnd_led_pc ,fnd_led_screen ,fnd_operation
where fnd_operation.status=1 and fnd_led_screen.status=1 and fnd_led_pc.status=1 and fnd_operation.status=fnd_led_screen.status and fnd_led_screen.status=fnd_led_pc.status ;
end;
即pc_id,screen_id只能出现一个
另外两张表里 都有这两个字段的数据,
要在新建的那张表中实现效果 即一条生产线要么只能生产 液晶屏 要么生产液晶电脑
两个都要输出但是 输出pc_id时screen_id那一列为空(就是不insert)
输出screen_id时pc_id那一列为空(就是不insert)
你的意思不大明白
我上面sql文的意思就是pc_id不为空时screen_id为空(即,插入NULL)
如果你需要的是两列并一列的话
insert into wip_led_opration(operation_id,led_id)
select
operation_id,
(case when led_pc_id is not null then led_pc_id else led_screen_id end) led_id
...