小编Lax*_*man的帖子

在Where子句中使用Zf2 NOT IN表达式

我试图从另一个表中尚未出现的表中获取结果.为此,我在where子句中使用subQuery和NOT IN表达式.正常的sql工作如下:

SELECT `products`.* FROM `products` WHERE `products`.`pro_id` **NOT IN** (
SELECT `product_collection`.`pro_id` AS `pro_id` FROM `product_collection` WHERE `coll_id` = '6' ) AND products.pro_id IN (55,56,57,62)
Run Code Online (Sandbox Code Playgroud)

我正在为项目使用zf2.问题是我不知道如何在where子句中使用NOT IN表达式.我们可以在Where子句中使用where-> in()作为IN表达式.例如.

//$productIds is an array
//$collectionId is an id

$subSelect = $this->getRawSql()->select('product_collection');
$subSelect -> columns(array('pro_id'));
$subSelect -> where(array('coll_id'=>$collectionId));

$select = $this->getRawSql()->select('products');
$select -> **where->in**('products.pro_id', $subSelect)
        -> where->in('products.pro_id',$productIds);
Run Code Online (Sandbox Code Playgroud)

但我不知道如何使用NOT IN表达式.

where-clause zend-framework2

8
推荐指数
1
解决办法
1万
查看次数

将轮廓路径转换为svg路径

我正在使用openCV和python从图像中提取轮廓.现在我需要将这些轮廓路径(列表)导出为svg路径.我怎样才能做到这一点?

码:

ret,thresh = cv2.threshold(imgray,27,25,0)
contours, hierarchy = cv2.findContours(thresh, cv2.RETR_EXTERNAL , cv2.CHAIN_APPROX_TC89_L1)
print(type(contours)) #type list
Run Code Online (Sandbox Code Playgroud)

python svg opencv contour opencv-contour

4
推荐指数
1
解决办法
3245
查看次数