newmomsforum
10-23-2009, 08:17 AM
Hi Guys
I've been trying to use the following SQL command to delete duplicate posts in a single thread:
SELECT bad_rows. * FROM post AS bad_rows
INNER JOIN (
SELECT threadid, dateline, username, userid, MIN( postid ) AS min_postid FROM post
GROUP BY threadid, dateline, userid
HAVING count( * ) >1
) AS good_rows ON good_rows.threadid = bad_rows.threadid
AND good_rows.dateline = bad_rows.dateline
AND good_rows.userid = bad_rows.userid
AND good_rows.min_postid <> bad_rows.postid
The SQL query was originally posted by Wayne here although this was for an earlier version of VB:
http://www.vbulletin.com/forum/showthread.php?t=285501
Unfortuantly, when I run this query on version 3.8 of my boards I get the following error message:
An error occurred while attempting to execute your query. The following information was returned.
error number: 1064
error desc: You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'SELECT threadid, dateline, username, userid, MIN( postid ) AS m
Does anyone have any ideas what will work on my boards :confused:
Many many thanks in advance
Regards
Mark
I've been trying to use the following SQL command to delete duplicate posts in a single thread:
SELECT bad_rows. * FROM post AS bad_rows
INNER JOIN (
SELECT threadid, dateline, username, userid, MIN( postid ) AS min_postid FROM post
GROUP BY threadid, dateline, userid
HAVING count( * ) >1
) AS good_rows ON good_rows.threadid = bad_rows.threadid
AND good_rows.dateline = bad_rows.dateline
AND good_rows.userid = bad_rows.userid
AND good_rows.min_postid <> bad_rows.postid
The SQL query was originally posted by Wayne here although this was for an earlier version of VB:
http://www.vbulletin.com/forum/showthread.php?t=285501
Unfortuantly, when I run this query on version 3.8 of my boards I get the following error message:
An error occurred while attempting to execute your query. The following information was returned.
error number: 1064
error desc: You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'SELECT threadid, dateline, username, userid, MIN( postid ) AS m
Does anyone have any ideas what will work on my boards :confused:
Many many thanks in advance
Regards
Mark