1

I want to create a view which displays a list of a particular content type. I only have access to the database and I need to figure out the list of content type through view; therefore, I am thinking to write SQL for it. Is it possible to do?

I am using Drupal 6.

4
  • 1
    are looking for sql query or views module to display content?
    – vgoradiya
    Commented Oct 6, 2015 at 11:12
  • no i want to create a view using SQL query Commented Oct 7, 2015 at 4:48
  • @RajenderRajan Merci for the accept! Better late then never, right? Commented Jun 22, 2016 at 10:35
  • Yeah !! Thanx again !! Commented Jun 22, 2016 at 10:36

1 Answer 1

1

List all content types

To build a list of all your content types in a Drupal 6 site, use an SQL query like so:

SELECT * FROM `node_type`

The values in the type column in the results you get, corresponds to the machine name for each of the content types you have in your site.

List all nodes of a particular content type

Here is an SQL query to display a list of nodes of content type story in a Drupal 6 site:

SELECT *  FROM `node` WHERE `type` = 'story'

Change story to the machine name of your particular content type (= any of the values in the type column from the first SQL above).

1
  • Moreover, what would be the SQL query for Content ,Content Type and its Taxonomy ? Commented Oct 8, 2015 at 5:09

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.