0

Line 3 is apparently incorrectly written. Can a MySql expert offer fixed query? Thanks!

SELECT  `rscno` 
FROM  `catalog_product_entity` WHERE `type_id` = 'simple' 
AS a INNER JOIN  `eav_attribute` AS `attribute` ON `attribute.attribute_code` =  'image'
AND `attribute.frontend_input` =  'media_image'
LEFT JOIN  `catalog_product_entity_varchar` AS b ON a.entity_id = b.entity_id
AND b.attribute_id = attribute.attribute_id
WHERE b.value =  ''
OR b.value IS NULL 
OR b.value =  'no_selection'
LIMIT 0 , 30

#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'AS a INNER JOIN eav_attribute AS attribute ON attribute.attribute_code = ' at line 3

1 Answer 1

2

I'm not sure what your query does, but

SELECT  `sku` 
FROM  `catalog_product_entity` AS a 
INNER JOIN  `eav_attribute` AS `attribute` ON `attribute`.attribute_code =  'image'
AND `attribute`.frontend_input =  'media_image'
LEFT JOIN  `catalog_product_entity_varchar` AS b ON a.entity_id = b.entity_id
AND b.attribute_id = attribute.attribute_id
WHERE `type_id` = 'simple' AND (b.value =  ''
OR b.value IS NULL 
OR b.value =  'no_selection')
LIMIT 0 , 30

Should fix the problem.

AS a needs to be after a FROM table or after a JOIN

2
  • Fabian I'm getting the same response error from your query code. I want to print out all the"rscno" product numbers from the table "catalog_product_entity", which are exclusively the ones that are of the "type_id" which equals "simple", that do not have an "media_image". This is a Magento query. Thank you for your previous answer! Commented Dec 21, 2013 at 21:29
  • Lots of missed set ` and a WHERE on the wrong position. This query works for me. NOW :-) Commented Dec 21, 2013 at 23:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.