我有一个在 Laravel 应用程序中使用的 MariaDB 查询,我希望它返回 7 列。当我使用 PHP 转储结果数组时,它似乎只返回 4。但是,当我采用相同的查询并在 PhpMyAdmin SQL 编辑器中运行它时,它返回的全部 7 与我的预期完全一致。
只是想知道是什么导致 Laravel 将结果过滤为只有四列:状态、姓名、电话号码和描述?
谢谢!
拉拉维尔查询:
$entries = DB::select('SELECT status, contacts.name, contacts.telephone_number, companies.name, roles.name, stages.description, actions.description FROM entries JOIN contacts ON entries.contact_id = contacts.id JOIN companies ON contacts.id = companies.contact_id JOIN roles ON companies.id = roles.company_id JOIN stages ON roles.id = stages.role_id JOIN actions ON stages.id = actions.stage_id');
PHPMyAdmin SQL 编辑器的查询:
SELECT status, contacts.name, contacts.telephone_number, companies.name, roles.name, stages.description, actions.description FROM entries JOIN contacts ON entries.contact_id = contacts.id JOIN companies ON contacts.id = companies.contact_id JOIN roles ON companies.id = roles.company_id JOIN stages ON roles.id = stages.role_id JOIN actions ON stages.id = actions.stage_id
一只萌萌小番薯
慕容3067478