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 Oct 6 '15 at 11:12
  • no i want to create a view using SQL query – Rajender Rajan Oct 7 '15 at 4:48
  • @RajenderRajan Merci for the accept! Better late then never, right? – Pierre.Vriens Jun 22 '16 at 10:35
  • Yeah !! Thanx again !! – Rajender Rajan Jun 22 '16 at 10:36
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 ? – Rajender Rajan Oct 8 '15 at 5:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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