[support] using drupal in mysql without subquery

Adam Cooper Adam_Cooper at europe.pall.com
Wed Oct 4 08:24:16 UTC 2006


>In Drupal installation that using MySQL without subquery support, what is 
the 
>right sql statement for this query?
>------------------------------------------------------------------
>SELECT count(u.name)
>FROM {users} u
>WHERE u.uid IN (SELECT uid from {node} n where type='blog')
>------------------------------------------------------------------
>Above query is show number of users who whas written Blog. 

Use a join:

SELECT count(u.name)
FROM {users} u 
JOIN {node} n
ON u.uid = n.uid
WHERE n.type = 'blog';

Thanks
Adam


-----------------------------------------
--------------------------------------------------------------
This message may contain confidential or privileged information,
and is intended only for the addressee or other persons entitled to
access the information. If you are not the intended or authorised
recipient of this message, please notify the sender by return and
then delete it from your mailbox. Any dissemination, distribution,
copying or use of this communication without prior permission is
prohibited. Internet communications are not secure and may be
susceptible to data corruption, interception, and unauthorised
amendment for which Pall Europe Limited does not accept liability.
Whilst we have taken all reasonable precautions to ensure that this
e-mail and any attachments have been swept for viruses, Pall Europe
Limited does not accept liability for losses sustained as a result
of software viruses. Any views or opinions expressed are solely
those of the author and do not necessarily represent those of Pall
Europe Limited unless otherwise specifically stated.

Registered Office and Corporate Headquarters: Pall Europe Limited,
Europa House, Havant Street, Portsmouth, PO1 3PD.
Registered No 769075, England.
--------------------------------------------------------------



More information about the support mailing list