I am trying to find the rows that exist inside an index, however, my results keep coming up null even though there are rows that match my index. Is there something wrong with the logic of my query?
Here is my test query:
SELECT `the_products` . *
FROM `the_products`
INNER JOIN `producttypes_index` ON `producttypes_index`.`the_product_id` = `the_products`.`id`
AND `producttypes_index`.`type_id` = '1'
INNER JOIN `producthashtags_index` ON `producthashtags_index`.`the_product_id` = `the_products`.`id`
WHERE
`producthashtags_index`.`producthashtag_id`
IN ('41')
AND
`producthashtags_index`.`producthashtag_id`
IN ('42')
AND
`producthashtags_index`.`producthashtag_id`
IN ('6')
ORDER BY updated_at DESC
Here you can see the_product_id
54433 exists inside the index table producthashtags_index
using query:
SELECT *
FROM `producthashtags_index`
WHERE `the_product_id` =54433
Results:
id producthashtag_id the_product_id
25433 6 54433
25434 41 54433
25435 42 54433
Then you can see it also exists inside the index table producttypes_index
using query:
SELECT *
FROM `producttypes_index`
WHERE `the_product_id` =54433
Results:
type_id the_product_id
1 54433