select
	order_no 批次号,
	resistivity 电阻档位,
	min 电阻低值,
	case
		when min >= 1.9 then '高阻'
		else '低阻'
	end 高低阻
from
	(
	select
		order_no ,
		resistivity,
		case
			when resistivity like '&gt;%' then SUBSTRING(resistivity, 5, 7)
			when resistivity like '%~%' then SUBSTRING_INDEX(resistivity, '~', 1)
			when resistivity like '%-%' then SUBSTRING_INDEX(resistivity, '-', 1)
			when resistivity like '&lt;%' then SUBSTRING(resistivity, 5, 7)
			when resistivity like '>%' then SUBSTRING(resistivity, 2, 7)
			when resistivity like '<%' then SUBSTRING(resistivity, 2, 7)
			when resistivity = '未分档'
			or resistivity is null then '未分档'
		end min
	from
		mes_sync.mes_recycle_material_storage mrms
union
	select
		order_no ,
		resistivity,
		case
			when resistivity like '&gt;%' then SUBSTRING(resistivity, 5, 7)
			when resistivity like '%~%' then SUBSTRING_INDEX(resistivity, '~', 1)
			when resistivity like '%-%' then SUBSTRING_INDEX(resistivity, '-', 1)
			when resistivity like '&lt;%' then SUBSTRING(resistivity, 5, 7)
			when resistivity like '>%' then SUBSTRING(resistivity, 2, 7)
			when resistivity like '<%' then SUBSTRING(resistivity, 2, 7)
			when resistivity = '未分档'
			or resistivity is null then '未分档'
		end
	from
		mes_sync.mes_disposable_qc_task
)a