图1是表1,图2是表2.表1中的 advantage 对应表2的 type ,以及图2的 with_id 对应表1的主键ID,也就是说,最终获取出来的数据是这种格式:array( "id" => 1, "title" => "string", "content" => "string", "advantage" => array(6), "features" => array(4), "process" => array(7));用join写获取出来的数据就搞不懂该怎么去遍历了。$res = ServiceList::alias("s") -> field("s.*") -> join("service_in_arr si", "s.id = si.with_id") -> field("si.title as title1, si.content as content1") -> select();这种写出来的数据即图3,表1仅1条数据,表2的数据仅是表1某字段的一个数据集。若我需要按照第一种格式去获取数据,这种该怎么写?请大神莅临指导,非常感谢!表1获取的格式<code>array( "id" => 1,"title" => "string","content" => "string","advantage" => "advantage","features" => "features","process" => "process");</code>表2获取的格式<code>array( "id" => 1,"with_id" => "string","type" => "string","title" => "string",);</code>需要的格式<code>array( "id" => 1,"title" => "string","content" => "string","advantage" => array(6),"features" => array(4),"process" => array(7));</code>
- 2 回答
- 0 关注
- 1739 浏览
添加回答
举报
0/150
提交
取消