PDA

View Full Version : simple quick mysql question


adamkearsley
11-17-2005, 06:28 PM
I need to run a query to change my topic_id table
at the moment it shows
topic_id=1770
i need to change this on all the items in an area with 1770 to 3879
i have this query
SQL query:
SELECT *
FROM `phpbb_posts`
WHERE `topic_id` =1770
LIMIT 0 , 2000
it shows me all posts with 1770
but what do i add to make it change that 1770?
Adam,

Paerez
11-17-2005, 07:34 PM
UPDATE [LOW_PRIORITY] [IGNORE] tbl_name
SET col_name1=expr1 [, col_name2=expr2 ...]
[WHERE where_definition]
[ORDER BY ...]
[LIMIT row_count]

So you want:

UPDATE `phbb_posts`
SET topic_id=3879
WHERE topic_id=1770
LIMIT 0,2000

adamkearsley
11-17-2005, 08:46 PM
cheers for the help!
Ad,