Php WooCommerce mysql-获取类别中的产品列表

Php WooCommerce mysql-获取类别中的产品列表,php,woocommerce,woocommerce-rest-api,Php,Woocommerce,Woocommerce Rest Api,我想检索子类别中的所有产品。这是我的代码: SELECT * from `wp_term_relationships` where term_taxonomy_id=$subcatId and object_id in(select ID from `wp_posts` where `post_type`='product' and post_status='publish' and ID=wp_term_relationships.object_id) 问题是,这段代码返回了大约20种

我想检索子类别中的所有产品。这是我的代码:

SELECT * from `wp_term_relationships` where term_taxonomy_id=$subcatId and 
object_id in(select ID from `wp_posts` where  `post_type`='product' and post_status='publish' and ID=wp_term_relationships.object_id) 
问题是,这段代码返回了大约20种产品,但当我在网站中转到那个类别时,它返回了大约40种产品

你能帮我吗?我需要一个代码来返回类别内的产品列表

SELECT * from `wp_term_relationships` where term_taxonomy_id=$subcatId and object_id in(select ID from `wp_posts` where `post_type`='product' and post_status='publish' and ID=wp_term_relationships.object_id) LIMIT 0,15000000
在mysql查询中使用Limit关键字

Limit接受起始值和结束值

如果您给出的是
限制5
,它将只显示前5条记录。 如果您给出的是
限制5,10
,它将显示5-10之间的记录。 如果您给出的是限制为0的大数字(例如
limit0100000000
),则它将显示最大100000000的所有记录