-1

I need to joint image root path with table column field. Here is my query which is not working. How I joint image path with "image"(name column in table) dynamic?

SELECT id, image, LOAD_FILE( 'D:/wamp/www/path/image/' + image ) IS NOT NULL AS exist FROM product HAVING exist=1

My images are in D: drive path. MySQL query not concat using "+" sign in LOAD_FILE function.

If I use static path in query then it's working fine.

SELECT id, image, LOAD_FILE('D:/wamp/www/path/image/catalog/image.jpg') IS NOT NULL as exist FROM product HAVING exist = 1

Thanks in advance. I need your help.

Vipul Jethva
  • 647
  • 1
  • 7
  • 27

1 Answers1

1
SELECT COUNT( DISTINCT product_id ) AS total, LOAD_FILE( CONCAT('D:/wamp/www/path/image/', image)) IS NOT NULL AS exist FROM oc_product HAVING exist=1

May it will help you

KMS
  • 566
  • 4
  • 16