【发布时间】:2018-12-24 19:59:55
【问题描述】:
这是基于 WordPress 和 WooCommerce 并处理 post 和 post_meta 表
我必须获取所有具有 meta_key = "_shop" 和 meta_value = "yes" 的产品 ID
典型情况:
如果元键和元值与父产品匹配,那么它的所有变体也必须包括。
如果元键和元值未与父项一起行进,但其变体具有元键和元值匹配,则仅返回变体。
Product(#18)(simple): _shop = 'yes'
Product(#19)(variable): _shop = 'yes' (Parent is Yes)
Product(#20)(variation): _shop = 'yes'
Product(#21)(variation): _shop = 'no'
Product(#22)(variation): _shop = 'no'
Product(#23)(simple): _shop = 'yes'
Product(#24)(variable): _shop = 'no' (parent is no)
Product(#25)(variation): _shop = 'no'
Product(#26)(variation): _shop = 'yes' (Only this variation)
Product(#20)(variation): _shop = 'no'
我需要的IDS:
#18 #19 #20 #21 #22 #23 #26
【问题讨论】:
-
您根据什么确定变异的父代?像 #25 的父母是 #24 吗?
标签: mysql wordpress woocommerce