有谁知道为什么以下会导致 Column 'id' in field list is ambiguous 错误?
$app_subj_current = \DB::table('tbl_subject')
->join('tbl_application', 'tbl_subject.id', '=', 'tbl_application.app_subj_id')
->where('tbl_application.id', $application)
->lists('tbl_subject.subj_type', 'tbl_subject.id');
我已经指定了我要引用的 ID 的表,所以我不明白为什么会收到此错误。
最佳答案
我发现以下解决了问题:
$app_subj_current = \DB::table('tbl_subject')
->join('tbl_application', 'tbl_subject.id', '=', 'tbl_application.app_subj_id')
->where('tbl_application.id', $application)
->select('tbl_subject.subj_type as x', 'tbl_subject.id as y')
->lists('x', 'y');
关于php - 字段列表中的列 'id' 使用 Eloquent 不明确,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35974070/