我正在尝试获取多维数组,从而导致我的sql查询。有点难以解释,所以请看下面我的例子。
这是我获取结果的SQL代码
SELECT
CONCAT(first_name, ' ', last_name) AS full_name,
role,
keyword,
department
FROM users
JOIN
role_module ON role_module.role_uuid = users.role_uuid
JOIN
modules ON modules.uuid = role_module.module_uuid
JOIN
roles ON roles.uuid = users.role_uuid
JOIN
departments ON departments.uuid = users.department_uuid
WHERE
users.uuid = :uuid
ORDER BY
modules.keyword ASC
这就是我得到的结果。
是否有可能获得类似结果
data: Array(1)
department: "Information Technology"
full_name: "sonson ixon"
role: "Super Admin"
keyword: Array(2)
[0]: "admin"
[1]: "employee"
那就是我试图得到的结果。由于关键字是唯一的不同结果,因此我尝试将值插入数组。