我有一个SQL查询,它不能用"Not Like"来完成它的工作. 最奇怪的是,如果我go 掉"不",并留下类似的东西,如果它正常工作的话,它会正常地列出"喜欢"所表示的一切.
但我想要相反的,我需要它省略掉"不喜欢"中的所有东西,而我得到的是相反的,而不是列出所有这些. 显然,"不喜欢"的意思正好相反.
这一切为什么要发生?
这将是我的SQL查询
这段代码是原创的,运行得很好.
SELECT last_update.post_id
FROM wp_postmeta last_update
JOIN wp_posts AS post ON last_update.post_id = post.ID
WHERE 1659698743 - last_update.meta_value > 86400
AND last_update.meta_key = '_ety_last_update'
AND post.post_status = 'publish'
ORDER BY last_update.meta_value ASC LIMIT 17
我添加这个是为了省略"不喜欢"
SELECT last_update.post_id
FROM wp_postmeta last_update
JOIN wp_posts AS post ON last_update.post_id = post.ID
JOIN wp_postmeta AS _ety_product_info ON last_update.post_id = _ety_product_info.post_id
WHERE 1659698743 - last_update.meta_value > 86400
AND last_update.meta_key = '_ety_last_update'
AND _ety_product_info.meta_value NOT LIKE '%Product data not found%'
AND post.post_status = 'publish'
ORDER BY last_update.meta_value ASC LIMIT 17
只需添加这两行,但它们并不起作用.
JOIN wp_postmeta AS _ety_product_info ON last_update.post_id = _ety_product_info.post_id
AND _ety_product_info.meta_value NOT LIKE '%Product data not found%'
我做错了什么?
My goal is to skip everything that contains "Product data not found"位于"META_VALUE"-"_TY_PRODUCT_INFO"中,并且不会显示在查询中