<ss******@gmail.com> wrote in message
news:11**********************@f14g2000cwb.googlegr oups.com...
Ok here's the thing... I have a vBulletin forum database... there is a
table in there called "post" which has all of my forums posts in it.
What I have are many posts with regular titles like "Oh hello how are
you" or whatever, and many posts (which are replies) with "Re:" before
them and whatever message following that.
I have recently updated my forums not to show the Re: thing, and I need
a quick way to execute a query or something that will CLEAR all titles
that have this "Re:" in the title area of the post table entries.
Anyone know how I can do this?
The table is called "post" and the cell (?) I guess is called "title."
There are over 8,000 entries in this post table so I really need to
find an efficient way to remove all of the titles with "Re:" ...
manually is just too long and too hard.
Thanks for your help.... by the way I'm running MySQL version 4.0.25 I
believe.
Well - what is it you want to do? It helps to be specific!
It is unclear whether you are trying to query or you wish to actually modify
the data in your table.
------------------------------------
Query for only titles that don't begin "Re:"
SELECT title
FROM post
WHERE NOT (title LIKE 'Re:%')
------------------------------------------
Query all titles but hide the leading "Re:"
SELECT title
IF (LEFT(title,3)='Re', RIGHT(title, LENGTH(title)-3), title) As
AdjustedTitle
FROM post
--------------------------------------------
Surely you didn't mean to delete those records when you said "CLEAR"
DELETE FROM post
WHERE title LIKE 'Re:';
------------------------------------------------
Or perhaps you meant to keep the records but remove the leading "Re:" from
[titles] in the table post !
UPDATE post
SET title = LEFT(title,3)='Re', RIGHT(title, LENGTH(title)-3)
WHERE title LIKE 'Re:';
---------------------------------------------------------
Thomas Bartkus