I see that in D6 the node table has only the title of the node. How to query database to get the body (content) of a particular node?

Update: I figured out the content bodies are stored in node_revisions table.

  • Are you asking this so as to be able to get this information from an external non-Drupal application?
    – Jimajamma
    Commented Mar 2, 2014 at 15:06

2 Answers 2


Drupal 7

In Drupal 7 body content is saved in field_data_body and field_revision_body tables.

So example query to fetch title and body would be:

SELECT title, r.body_value, n.changed FROM node n LEFT JOIN field_data_body r ON n.nid = r.entity_id AND n.vid = r.revision_id

To query via drush, run drush sqlq following by above query.

  • 1
    Give this man a beer. Commented Mar 14, 2019 at 23:14

For education purposes, this is the sql that D6 Views produces (according to its sql preview):

This particular node would be the one having node id 1:

SELECT node_revisions.body AS node_revisions_body,
       node_revisions.format AS node_revisions_format
FROM node node
LEFT JOIN node_revisions node_revisions 
ON node.vid = node_revisions.vid 
WHERE node.nid = 1

In a module, however, you should use proper methods such as db_query() for maintainability and security.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.