还有就是如果直接使用JION要怎么查询呢?
麻烦高手帮忙看下是哪里出现问题了。
关联的代码:
'attributes' => array(
'mapping_type' => self::MANY_TO_MANY, //多对多关系
'class_name' => 'attributes',
'foreign_key' => 'did',
'relation_foreign_key' => 'aid',
'relation_table' => 'think_article_attributes' //此处应显式定义中间表名称,且不能使用C函数读取表前缀
),
控制器的代码:
$Sql = D('article')->relation(true)->where("id=$_GET[id]")->find();/
最佳答案