Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/arduino/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Mysql 不在查询中与我的sql中的值不匹配_Mysql_Sql - Fatal编程技术网

Mysql 不在查询中与我的sql中的值不匹配

Mysql 不在查询中与我的sql中的值不匹配,mysql,sql,Mysql,Sql,我的问题是: select * from customer_purchase_order where purchase_id NOT IN (SELECT cus_po_no FROM cus_comercial_invoice) 在此采购标识中,客户商业发票表中的客户采购单号为单值,但客户采购单号为多值 例如: Purchase_id 1: POV162031. Purchase_id 2: POV162125. cus_po_no : 'POV162031','POV162125'.

我的问题是:

select * from customer_purchase_order  where purchase_id NOT IN (SELECT cus_po_no FROM cus_comercial_invoice)
在此采购标识中,客户商业发票表中的客户采购单号为单值,但客户采购单号为多值

例如:

Purchase_id 1: POV162031.
Purchase_id 2: POV162125.

cus_po_no : 'POV162031','POV162125'.

不在查询中不工作

如果要联接外键、主键上的行,请使用
join

select * from customer_purchase_order cpo JOIN 
cus_comercial_invoice cci 
ON cpo.purchase_id = cci.cus_po_no 

您不正确,请看这一点-它按预期工作。

采购id
客户订单号
相同类型吗?如果您发布stacktrace,将很容易回答相同类型和相同值。对于ex:a=1和a=2等。如果您的值相同,您将得到空集。如果您得到任何其他错误或异常,请首先向我们提供详细信息执行->
从客户商业发票中选择客户订单号
您得到了什么?