数据库
产品
id name
1 Product #1
2 Product #2
3 Product #3
4 Product #4
审查
id idUser idProduct Rating
1 1 1 A Long Boring Review that is up to 500 characters
2 1 2 A Long Boring Review that is up to 500 characters
3 2 4 A Long Boring Review that is up to 500 characters
4 1 1 A Long Boring Review that is up to 500 characters
从这两个数据库中提取信息并安排它们的最佳方式是什么:
[0] => stdClass Object
(
[id] => 1
[name] => Product #1
[reviews] => Array(
[0]=>
(
[id] => "1"
[idUser] => "1"
[idProduct] => "1"
[Rating] => "A Long Boring Review that is up to 500 characters"
)
[1] = >
(...
)
)
[1] => stdClass Object
(
[id] => 2
[name] => Product #2
[reviews] => Array(
[0]=>
(
[id] => "1"
[idUser] => "1"
[idProduct] => "2"
[Rating] => "A Long Boring Review that is up to 500 characters"
)
[1] = >
(...
)
)
我正在考虑使用 GROUP_CONCAT 但这不会在以后引起很多性能问题吗?也没有字数限制吗?