1 回答
TA贡献1848条经验 获得超6个赞
你可以使用 addSelect 方法来做到这一点:
$records = DB::table('dmf_result_set_assign as rsa')
->select(
'pmu.s_image_url', 'pmu.r_image_url', 'pmu.r_image_url_main', 'pmu.product_sku',
'pmu.product_name', 'pmu.product_id', 'pmu.ai_result',
'pmu.confidence_score', 'pmu.request_id',
)
->join('dmf_product_match_unmatches as pmu', DB::raw('BINARY `pmu`.`hash_id`'), '=', 'rsa.hash_id')
->join('dmf_filter_rules as fr', 'fr.id', '=', 'rsa.filter_rule_id')
->leftjoin('dmf_user_tokens as tkn', 'tkn.id', 'rsa.assigned_to')
->leftjoin('users as usr', 'usr.id', '=', 'tkn.user_id');
if ($distinct_only_flag) {
$records = $records->addSelect(DB::raw('DISTINCT pmu.hash_id'),
'pmu.run_date_id',
'pmu.s_product_url',
'pmu.r_product_url',
'pmu.s_price',
'pmu.s_mpn',
'pmu.s_upc',
'pmu.s_asin',
'pmu.s_gtin',
'pmu.s_variant_info',
'pmu.s_brand',
'pmu.s_category',
'pmu.s_description');
} else {
$records = $records->addSelect('pmu.hash_id',
'fr.filter_name',
'rsa.human_verdict', 'rsa.assigned_to',
DB::raw('CONCAT(usr.first_name, " ", usr.last_name) as cloud_user'))
}
$records = $records->get();
- 1 回答
- 0 关注
- 87 浏览
添加回答
举报