【发布时间】:2018-03-14 03:11:35
【问题描述】:
所以我有这张桌子
EMP_ID SECTION TEST SAMPLE_NAME QUANTITY
1001 molecular reo heart 3
1001 molecular reo spleen 4
这是我的模型代码。
$query = $this->db->select('section, quantity,test,sample_name')
->from('tblmastersection')
->where('emp_id', $emp_id)
->order_by("save_section_id", "asc")
->join('tblsavesection', 'tblmastersection.section_id = tblsavesection.section_id', 'inner')
->join('tbljoinedtests', 'tblsavesection.test_id = tbljoinedtests.test_id', 'inner')
->join('tblmastersample', 'tblsavesection.samp_id = tblmastersample.samp_id', 'inner')
->get();
return $query->result();
我想做的就是让它变成这样..
EMP_ID SECTION TEST SAMPLE_NAME QUANTITY
1001 molecular reo heart, spleen 7
具有相同EMP_ID 的行将连接并汇总数量。
有人请帮我重新设计我的代码。非常感谢。
【问题讨论】:
标签: sql-server codeigniter concatenation