根据查询的结果, 除了这2个字段别的字段都相同。那么能不能整合成⼀条数据呢?当然是可以的。⽤到 mysql的关键字
GROUP_CONCAT
1 select q.barcode,q.PATIENTNO,q.PATIENTNAME,q.PATIENTSEX,q.PATIENTAGE,q.PATIENTTYPE2 ,q.SAMPLETIME,q.SAMPLETYPE,q.DOCTORDEPTID,q.DOCTORDEPTNAME3 ,q.DOCTORNAME,q.MEMO
4 , GROUP_CONCAT(q.his_itemcode SEPARATOR ',') his_itemcode ,GROUP_CONCAT(q.his_itemname SEPARATOR ',') his_itemname,ss.code,ss.name,ssr.stock_bin_code,ssb.name5 from lis_queue_reg q
6 join sampling_setting ss on ss.active =1
7 join sampling_setting_rel ssr on ssr.setting_code = ss.code and q.his_itemcode = ssr.item_code8 join sampling_stock_bin ssb on ssb.code = ssr.stock_bin_code9 WHERE q.PATIENTNAME='钟敏' and BARCODE='1002982470'
结果如下
因篇幅问题不能全部显示,请点此查看更多更全内容