insert into a(a,b,c) select '01', x,'N' from b where x='999'
不好意思!写错了: insert int a(a,b,c) select '01',(select x from b where x='999'),'N'; 应该是:insert int a(a,b,c) select '01',(select x from b where b.x=c.y),'N' from c;
insert into a(a,b,c) select '01', x,'N' from b where x='999'
insert int a(a,b,c) (select '01',b.x ,'N' from b,c where b.x=c.y);
是我说的不明白.事实上是这样的: insert int a(a,b,c) select '01',(select x from b where b.x=c.y),'N' from c; '01','N'实际上表c的字段值,即: insert int a(a,b,c) select c.x,(select x from b where b.x=c.y),c.z from c;
试试这个吧, insert into a(a,b,c) select '01',b.x,'N' from b,c where b.x=c.y;
insert int a(a,b,c) select '01',(select x from b where x='999'),'N';
应该是:insert int a(a,b,c) select '01',(select x from b where b.x=c.y),'N' from c;
(select '01',b.x ,'N' from b,c where b.x=c.y);
insert int a(a,b,c) select '01',(select x from b where b.x=c.y),'N' from c;
'01','N'实际上表c的字段值,即:
insert int a(a,b,c) select c.x,(select x from b where b.x=c.y),c.z from c;
insert into a(a,b,c) select '01',b.x,'N' from b,c where b.x=c.y;
我这个语句其实是做了一个代码转换,表b是一个代码表,用它的汉字来替换表c中查出的字母代码,如果改成楼上的形式,只是如果表c的代码在表b中不存在,那么,我的语句只是这个值为空,而换成楼上的语句,就会少了一行.
where b.x=c.y;
where b.x=c.y(+);
用一个左连接不就可以了么???