我正在尝试将内容表“ node_field_data”与自定义字段表“ node__field_reference_type”连接在一起,但找不到引用这两个表的分类表。
我在数据库中使用的是Drupal 8.5.4和mysql。
node__field_reference_type
+---------+------------+--------------------------------+
| bundle | entity_id | field_reference_type_target_id |
+---------+------------+--------------------------------+
| test | 10916 | 71 |
+---------+------------+--------------------------------+
node_field_data
+-------+-------+------+----------------------+
| nid | vid | type | title |
+-------+-------+------+----------------------+
| 10916 | 10905 | test | This is a post title |
+-------+-------+------+----------------------+
我不知道“ field_reference_type_target_id”是指什么
答案 0 :(得分:0)
在这里我要走了,假设您正在尝试获取该字段的分类法值。 field_reference_type_target_id 是指分类法ID。 因此,要获得分类术语值,请执行以下操作:
SELECT ttfd.name FROM node_field_data AS nfd
JOIN node__field_legacy_category AS nflc ON nfd.nid = nflc.entity_id
JOIN taxonomy_term_field_data AS ttfd ON ttfd.tid =
nflc.field_legacy_category_target_id
where type = '' and nid = '12345'