Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.
Moderator: General Moderators
Luke
The Ninja Space Mod
Posts: 6424 Joined: Fri Aug 05, 2005 1:53 pm
Location: Paradise, CA
Post
by Luke » Wed Jan 17, 2007 10:06 pm
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
volka
DevNet Evangelist
Posts: 8391 Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger
Post
by volka » Wed Jan 17, 2007 11:08 pm
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'
feyd
Neighborhood Spidermoddy
Posts: 31559 Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA
Post
by feyd » Thu Jan 18, 2007 7:33 am
Write a separate script that updates the fields to not have dashes at all?
Luke
The Ninja Space Mod
Posts: 6424 Joined: Fri Aug 05, 2005 1:53 pm
Location: Paradise, CA
Post
by Luke » Thu Jan 18, 2007 9:00 am
good call