<foreach collection="tailList" item="tail" index="index" open=" " close=" " separator=",">
min(case
when tail_no=' $ {tail.tail_No}' and type=2 then '1'
when tail_no=' $ {tail.tail_No}' and type=3 then '2'
else 'N/A' end) AS $ {tail.tailNo}
min(case
when tail_no=' $ {tail.tail_No}' and type=2 then '1'
when tail_no=' $ {tail.tail_No}' and type=3 then '2'
else 'N/A' end) AS $ {tail.tailNo}
</foreach>
is $ not #