Drupal Questions & Answers

Ask and answer Drupal related questions! No question too simple or complex!
runeveryday's picture
Asked by on Tue 18th May 2010
how to output this sql query?

want to output the articles’ title,the articles’ teaser,and its created time. in the database, the content type name i created is “companynews”,now i want to get the result is in the {node} and {node_revisions}table,how to use one query to get those result? i use this query,how to output this sql query?

$result = pager_query("SELECT n.nid, n.title, n.created, r.teaser FROM {node} n INNER JOIN {node_revisions} r ON n.nid = r.nid WHERE n.type = 'companynews' ORDER BY n.created DESC", 2);

Commenting on this Drupal Question is closed.