I'm not familiar with drupal. Using raw SQL, I'd like to extract votes given to each node, but I wonder how vote_rating
is related to node
?
I see that the votes are stored in field_vote_rating
of this table:
mysql> DESCRIBE `field_data_field_vote`;
+-------------------+------------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+-------------------+------------------+------+-----+---------+-------+
| entity_type | varchar(128) | NO | PRI | | |
| bundle | varchar(128) | NO | MUL | | |
| deleted | tinyint(4) | NO | PRI | 0 | |
| entity_id | int(10) unsigned | NO | PRI | NULL | |
| revision_id | int(10) unsigned | YES | MUL | NULL | |
| language | varchar(32) | NO | PRI | | |
| delta | int(10) unsigned | NO | PRI | NULL | |
| field_vote_rating | int(10) unsigned | YES | | NULL | |
| field_vote_target | int(10) unsigned | YES | | NULL | |
+-------------------+------------------+------+-----+---------+-------+
I'm aware of Drupal's database structure schema, which looks like so:
But I cannot figure out how to make a query to connect them.
My question: How to make a raw SQL query to get the node/node_votes pairs?
Any suggestions?