select
*
from
(
select
*, concat(
name
,code)
as
__f
from
test
order
by
date
desc
) __t
group
by
__f;
SELECTSELECT *FROM ( SELECT f.`商品名`, f.`规格`, r.`产地`, concat( f.`商品名`, f.`规格`, r.`产地` ) AS __f FROM FIRST AS f LEFT JOIN results r ON ( ( f.生产企业 LIKE CONCAT('%', r.`产地`, '%') #OR r.`产地` LIKE CONCAT('%', f.生产企业, '%') ) AND ( f.`药品名称` LIKE CONCAT('%', r.`名称`, '%') #OR r.`名称` LIKE CONCAT('%',f.`药品名称` , '%') ) ) WHERE f.`商品名` != '无' AND r.`产地` != '' ) __tGROUP BY __f;