Reputation: 3496
As the title says: I'm a newbie drupal user and I need to automatize the export of the "username" from the table user and some related fields from the "content_type_profile" table. I guess I shouldn't use any kind of module to try to get out this data since I need to run a script and generate a separated data from the html page and generate a pdf as it is needed. So I tried to join togheter both of the tables by using:
select name, field_username_value, field_surname_value from users as u inner join content_type_profile as p on u.uid = p.vid;
But I found out that the uid and the vid in the content table doesn't match and I can't find where is the third table I need to get this relation working. I can't find any documentation which simply explaines how Drupal manage these content_type tables either. - How can achieve this kind of export from the Drupal db? - Can anyone please point me out to which documents do I need to read to achieve my goal?
Thanks guys
Upvotes: 0
Views: 1305
Reputation: 36955
It's the node
table you need to join in:
SELECT u.name, ctp.field_username_value, ctp.field_surname_value
FROM users u
INNER JOIN node n ON n.uid = u.uid
INNER JOIN content_type_profile ctp ON ctp.vid = n.vid
The content type tables are provided by the CCK module, they're not part of Drupal core; that might be why you're struggling to find documentation (though there is plenty out there).
Upvotes: 1