小编Gra*_*les的帖子

SQL连接和组项目作为数组

我有以下SQL

SELECT articles.id, articles.title, tags.name AS tags
FROM articles
LEFT JOIN article_tag_association ON articles.id = article_tag_association.article_id
LEFT JOIN tags ON tags.id = article_tag_association.tag_id
Run Code Online (Sandbox Code Playgroud)

这可以正常工作,除了它为文章所拥有的每个标签创建一行,其中包含限制

例如

[
 "0" => ["id" => "1", "title" => "test", "tags" => "tag1"],
 "1" => ["id" => "1", "title" => "test", "tags" => "tag2"],
 "2" => ["id" => "2", "title" => "test2", "tags" => "tag1"],
]
Run Code Online (Sandbox Code Playgroud)

(只有2篇文章,但有3行)

有没有办法让它用一系列标签返回每篇文章?

就像是:

[
 "0" => ["id" => "1", "title" => "test", "tags" => ["tag1", "tag2"]],
 "1" => ["id" => …
Run Code Online (Sandbox Code Playgroud)

mysql sql join

7
推荐指数
2
解决办法
1万
查看次数

插值{{}}和[innerText]之间的性能差异 - 角度2

在Angular 1中使用ng-bind可以提高插值性能.

Angular 2中的情况仍然如此吗?我应该使用[innerText]过插值.

例如

<p>{{slower}}</p>
<p [innerText]="faster"></p>
Run Code Online (Sandbox Code Playgroud)

performance angularjs angular

4
推荐指数
1
解决办法
2325
查看次数

标签 统计

angular ×1

angularjs ×1

join ×1

mysql ×1

performance ×1

sql ×1