YII 框架多表条件联合查询

根据网上查到的文章及YII官网介绍,整了好长时间。配置好relations。在search函数中需要如下处理:

设置$criteria->together这步很重要,不然总是会报SQL语法错误。

Leave a Reply

邮箱地址不会被公开。 必填项已用*标注

You may use these HTML tags and attributes:

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">