You are here:  » Mysql query help needed...

Support Forum



Mysql query help needed...

Submitted by paul30 on Sun, 2010-02-28 22:15 in

Hello, I run a highly modified version of PT and wanted to ask a question concerning MYSQL query creation.

I store all the images locally, and image file names are constructed from value of SITE_URL+dup_harch+.jpg

Some of the images are renamed later on, and I want to run a query to see how many Not Renamed images do I have.

To the question:

Is it possible to have something similar to:

SELECT * FROM products where dup_harch LIKE '%image_url%'

Explanation of the above :) - I want to select products that have dup_harch value in a PART of image_url value of the same product.

Thanks a lot in advance.
Paul

Submitted by support on Mon, 2010-03-01 11:37

Hello Paul,

I assume you mean the `dupe_hash` column; and yes you should be able to reference it within a LIKE condition. Have a go with the following SQL:

SELECT * FROM products WHERE image_url LIKE CONCAT('%',dupe_hash,'%');

Hope this helps!

Cheers,
David.

Submitted by paul30 on Mon, 2010-03-01 14:46

It works perfectly!

Thank you very much!