PDA

View Full Version : MySQL Query Help


UserName
Sun 18th Jun '00, 3:07pm
I recently converted my site from UBB to vBulletin. For some reason, and it could be my mistake, the "homepage" field in the "user" table shows the following value "http://" for all users who were imported that didn't have a "homepage" set.

I want to clear that value from the database and return it to a blank field for all users that show the values of "http://". But, many users do have a "homepage" set and it usually starts with a "http://". So, I want to write a query to go through the database and erase the value "http://" in the "homepage" field of the "user" table for all records where the value is exactly "http://" without touching the records that also include the value "http://". My fear is that I will write a query that will blank the homepage field in all records that *contain* "http://" or that will delete the "http://" from the beginning of the existing correct records. I only want to blank the "homepage" field of the users that have exactly "http://".

If any MySQL query guru can suggest a proper query, I would appreciate it.

Thanks!

Mas*Mind
Sun 18th Jun '00, 5:01pm
UPDATE user
SET homepage = ''
WHERE homepage = 'http://'

would do it, it'll only erase fields that matches the http:// exactly

[Edited by Mas*Mind on 06-19-2000 at 06:12 AM]

UserName
Sun 18th Jun '00, 8:03pm
Thanks, Mas*Mind! :)