我正在尝试使用以下代码从同一数据库查询中的两个数据库表中检索信息:
$query = db_select('webform_questionnaire_fieldset', 'wqf');
$query->join('webform_component', 'wc', 'wqf.cid = wc.cid');
$query->fields('wqf')
->fields('wc')
->condition('wqf.cid', $cid, '=')
->condition('wqf.nid', $nid, '=')
->condition('wqf.cid', 'wc.cid', '=')
->execute()
->fetchAll();
我得到的输出与数据库数据不相似,但看起来更像数据库元数据,如下所示:
SelectQuery::__set_state(array(
'fields' =>
array (
),
'expressions' =>
array (
),
'tables' =>
array (
'wqf' =>
array (
'join type' => NULL,
'table' => 'webform_questionnaire_fieldset',
'alias' => 'wqf',
'condition' => NULL,
'arguments' =>
array (
),
'all_fields' => true,
),
'wc' =>
array (
'join type' => 'INNER',
'table' => 'webform_component',
'alias' => 'wc',
'condition' => NULL,
'arguments' =>
array (
),
'all_fields' => true,
),
),
'order' =>
array (
), ......
谁能告诉我我做错了什么?