Mysql 如何在不存在的查询上应用子查询?
我有以下代码:Mysql 如何在不存在的查询上应用子查询?,mysql,sql,Mysql,Sql,我有以下代码: select * from outerb where not exists(select * from wms where outerb.barcode = wms.barcode); 我想在此处添加此代码: select concat('0',barcode) from outerb 我之所以这样做是因为我需要在所有条形码之前添加一个额外的0,并将其与另一个表连接在一起 这就是我迄今为止所尝试的: select concat('0',barcode) as x from
select * from outerb where not exists(select * from wms where
outerb.barcode = wms.barcode);
我想在此处添加此代码:
select concat('0',barcode) from outerb
我之所以这样做是因为我需要在所有条形码之前添加一个额外的0
,并将其与另一个表连接在一起
这就是我迄今为止所尝试的:
select concat('0',barcode) as x from outerb join wms on outerb.x =
wms.barcode;
但字段列表中的
列“barcode”不明确时出现错误
请在barcode列之前使用表别名
select concat('0',outerb.barcode) as x from
outerb join wms on concat('0',outerb.barcode) = wms.barcode
where not exists (select * from wms where concat('0',outerb.barcode) = wms.barcode)
在条形码列之前使用表别名
select concat('0',outerb.barcode) as x from
outerb join wms on concat('0',outerb.barcode) = wms.barcode
where not exists (select * from wms where concat('0',outerb.barcode) = wms.barcode)
两个表中都有一个列条形码,因此您会得到该错误。试试这个:
select concat('0',outerb.barcode) as x
from outerb join wms
on concat('0',outerb.barcode) = wms.barcode;
两个表中都有一个列条形码,因此您会得到该错误。试试这个:
select concat('0',outerb.barcode) as x
from outerb join wms
on concat('0',outerb.barcode) = wms.barcode;
字段列表中的列“条形码”不明确
使用别名克服此问题字段列表中的列“条形码”不明确
使用别名克服“on子句”中的未知列“outerb.x”,为什么outerb.x不起作用?还有一点很奇怪,我该如何添加NOT EXISTS
查询?@Eduards,我在'on子句'intresting'中添加了itunknown列'outerb.x',为什么outerb.x
不起作用?好奇的是,我该如何添加不存在
查询?@Eduards,我已经添加了它