[development] hook_views_query_alter

Earl Miles merlin at logrus.com
Sat Oct 30 20:52:13 UTC 2010


On 10/30/2010 11:36 AM, Ashraf Amayreh wrote:
> 
> Now with my special case, the query would need to change to:
> 
> SELECT n.nid, n.title FROM node n
> INNER JOIN term_node tn ON n.nid = tn.nid
> INNER JOIN content_type_document ctd ON n.nid = ctd.nid
> INNER JOIN files f ON ctd.field_documet_file_fid = f.fid
> WHERE n.type = 'document' AND tn.tid IN (7) AND f.filename like '%.doc'
> ORDER BY n.created DESC

Assuming that the filefield module offers a relationship to the files
table (it should, but I can't confirm that it does) then you add that
relationship, then add File: Name using the "Ends With" operator.
Alternatively you can use the File: Mime Type filter as well since I
think .doc has its own mime type.


More information about the development mailing list