select top 12 id, cpmc(产品名称),gsmc(公司名称) from qyzc_cpxx where id in(select id from qyzc_cpxx tb where not exists
(select 1 from qyzc_cpxx where hyxx_id=tb.hyxx_id and id>tb.id) and (ycd like '四川%' or ycd like '成都%'))
(select 1 from qyzc_cpxx where hyxx_id=tb.hyxx_id and id>tb.id) and (ycd like '四川%' or ycd like '成都%'))