Closed (fixed)
Project:
Nodequeue
Version:
7.x-2.x-dev
Component:
Code
Priority:
Critical
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
9 Oct 2006 at 08:56 UTC
Updated:
26 Nov 2006 at 02:16 UTC
// $Id: nodequeue.module,v 1.37 2006/08/10 21:41:26 killes Exp $
nodequeue_page_form()
The first query of this function gives wrong COUNT results in 'numrows'.
The query should be something like this instead:
SELECT
nq.qid, nq.title, nq.size, COUNT(DISTINCT(nqn.nid)) AS numnodes
FROM
nodequeue_queue nq
LEFT JOIN nodequeue_types nt ON (nq.qid = nt.qid)
LEFT JOIN nodequeue_roles nr ON (nq.qid = nr.qid)
LEFT JOIN nodequeue_nodes nqn ON (nq.qid = nqn.qid)
WHERE
nt.type = '%s' AND nr.rid IN (". implode(',', $role_args) .")
GROUP BY
nq.qid
ORDER BY
nq.title
No need to use INNER JOIN or another GROUP BY.
At the moment, your query returns multiple rows and always 1 in numrows.
Comments
Comment #1
merlinofchaos commentedFixed. The INNER joins are left in; they are more efficient than LEFT joins and provide faster queries as long as you know that there will always be records to join with. Which in this case there will be.
This will go out in the 1.1 release for 4.7
Comment #2
merlinofchaos commentedComment #3
(not verified) commented