<?xml version="1.0" encoding="utf-8" ?>
<select>
	<selectstr>
SELECT u_mattress.mattressid
	,u_mattress.erp_mtrlid
	,u_mattress.mattressname
	,u_mattress.erp_configcodetype
	,u_mattress.mattresscode
	,u_mattress.mattressrelcode
	,erp_mtrltypeid
	,erp_mtrlcode
	,erp_mtrlname
	,erp_mtrlmode
	,erp_mtrlunit
	,erp_mtrltype
	,CASE 
		WHEN isnull(erp_mtrlengname, '') = ''
			THEN mattressrelcode
		ELSE erp_mtrlengname
		END AS mtrlengname
	,old_mtrlname AS old_mtrlname
FROM u_mattress
	</selectstr>
	<where>
		<when notnull="@mattressid">
			u_mattress.mattressid = @mattressid
		</when>
	</where>
	<displayfields>
	</displayfields>
</select>
