SELECT title, COUNT(*) as count
FROM xf_resource
GROUP BY title
HAVING count > 1;
xf_resource table, along with the number of times each title appears.What version of XenForo is that query for? The current version of XenForo Resources table isHere's a SQL query to find XenForo resources with duplicate titles:
Code:SELECT title, COUNT(*) as count FROM xf_resource GROUP BY title HAVING count > 1;
This query will return a list of all resource titles that appear more than once in thexf_resourcetable, along with the number of times each title appears.
xf_rm_resource.I apologize for the confusion. The query I provided is for XenForo 1.x versions where the resource table is namedWhat version of XenForo is that query for? The current version of XenForo Resources table isxf_rm_resource.
xf_resource. xf_rm_resource. Here's the updated query for XenForo 2.x:SELECT title, COUNT(*) as count
FROM xf_rm_resource
GROUP BY title
HAVING count > 1;
xf_rm_resource table, along with the number of times each title appears.Can you write a SQL query to update the XenForo table xf_rm_resource to update the resource_date to be the same as the associated discussion thread?Here's the updated query for XenForo 2.x:
Sure, here's a SQL query to update theCan you write a SQL query to update the XenForo table xf_rm_resource to update the resource_date to be the same as the associated discussion thread?
xf_rm_resource table in XenForo 2.x to set the resource_date column to be the same as the associated discussion thread:UPDATE xf_rm_resource AS r
INNER JOIN xf_thread AS t ON r.discussion_thread_id = t.thread_id
SET r.resource_date = t.post_date;
INNER JOIN to match the discussion_thread_id column in the xf_rm_resource table with the thread_id column in the xf_thread table. It then sets the resource_date column in the xf_rm_resource table to be the same as the post_date column in the xf_thread table.Can you revise that SQL query so that it only does it where resource_id is '1'?Sure, here's a SQL query to update thexf_rm_resourcetable in XenForo 2.x to set theresource_datecolumn to be the same as the associated discussion thread:
Sure, here's the revised SQL query to update theCan you revise that SQL query so that it only does it where resource_id is '1'?
xf_rm_resource table in XenForo 2.x to set the resource_date column to be the same as the associated discussion thread, but only for the resource with resource_id equal to 1:UPDATE xf_rm_resource AS r
INNER JOIN xf_thread AS t ON r.discussion_thread_id = t.thread_id
SET r.resource_date = t.post_date
WHERE r.resource_id = 1;
WHERE clause to filter the update to only the resource with resource_id equal to 1. Can you revise that SQL query to also include the last_update value?Sure, here's the revised SQL query to update thexf_rm_resourcetable in XenForo 2.x to set theresource_datecolumn to be the same as the associated discussion thread, but only for the resource withresource_idequal to 1:
Sure, here's the revised SQL query to update both theCan you revise that SQL query to also include the last_update value?
resource_date and last_update columns in the xf_rm_resource table in XenForo 2.x to be the same as the associated discussion thread, but only for the resource with resource_id equal to 1:UPDATE xf_rm_resource AS r
INNER JOIN xf_thread AS t ON r.discussion_thread_id = t.thread_id
SET r.resource_date = t.post_date, r.last_update = t.last_post_date
WHERE r.resource_id = 1;
WHERE clause to filter the update to only the resource with resource_id equal to 1.