Page 1 of 1

searching for sku with or without dashes

Posted: Wed Jan 17, 2007 10:06 pm
by Luke
I have a table (which I have no control over) which has some of its products skus listed with dashes (010-00433-00) and some without (0100043300). How would I

Code: Select all

SELECT id FROM products WHERE sku = 0100043300
and have it find 010-00433-00 or 0100043300

does it require regex? I hope not :(

Posted: Wed Jan 17, 2007 11:08 pm
by volka
If you like IN more than REGEXP

Code: Select all

SELECT
	id
FROM
	products
WHERE
	sku IN ('0100043300', '010-00433-00')
or

Code: Select all

SELECT
	id
FROM
	products
WHERE
	sku='0100043300'
	OR sku='010-00433-00'

Posted: Thu Jan 18, 2007 7:33 am
by feyd
Write a separate script that updates the fields to not have dashes at all? :)

Posted: Thu Jan 18, 2007 9:00 am
by Luke
good call :D