Date: 11/02/05 (MySQL Communtiy) Keywords: database Big thanks to
SELECT product_id, name, description, title, manufacturer,
warehouse_price, product_markup, supplier_markup, filename,
thumbnail_width, thumbnail_height, sell_price, minimum_price,
item_number, category_key
FROM product
INNER JOIN supplier
ON supplier_key = supplier_id
INNER JOIN picture
ON picture_key = picture_id
WHERE placement_fe = 1 AND
product.active > 0 AND
(name LIKE '%mini%' OR
description LIKE '%mini%' OR
title LIKE '%mini%' OR
manufacturer LIKE '%mini%' OR
product_id='mini' OR
item_number='mini')
Now, my problem is that this will return items with titles like "Feminine" when I really just want titles with the word "mini" in them. Is there an easy way around this or do I have to use regular expressions? If I have to use a regexp, what would you recommend to be the most efficient query to do it? Thanks! Source: http://www.livejournal.com/community/mysql/72112.html
|