constsqlStr=`SELECT concat(code_type,code_value),code_name FROM CODE_VALUE where code_type in('%s') union SELECT concat(code_type,code_value),code_name3 FROM CODE_VALUE where code_type='ZB01'`
constsqlCodeStr=`SELECT concat(code_type,code_value),code_name FROM CODE_VALUE where code_type in('%s') union SELECT concat(code_type,code_value),code_name3 FROM CODE_VALUE where code_type='ZB01'`
rows,_:=db.Query(fmt.Sprintf(`select %s from a01 where a0163='1' and exists(select 1 from a02 a02 where a01.a0000=a02.a0000 and a0281='true' and a02.A0201B='%s') order by (select lpad(max(a0225),5,'0') from a02 where a01.a0000=a02.a0000 and a02.a0281='true' and a02.A0201B='%s')`,codes,b0111,b0111))
varsqlstring
iftypeStr=="1"{
sql=fmt.Sprintf(`select %s from a01 where a0163='1' and exists(select 1 from a02 a02 where a01.a0000=a02.a0000 and a0279='1' and A0201B='%s') order by (select lpad(max(a0225),5,'0') from a02 where a01.a0000=a02.a0000 and a0279='1' and A0201B='%s')`,codes,b0111,b0111)
}else{
sql=fmt.Sprintf(`select %s from a01 where a0163='1' and exists(select 1 from a02 a02 where a01.a0000=a02.a0000 and a0281='true' and A0201B='%s') order by (select lpad(max(a0225),5,'0') from a02 where a01.a0000=a02.a0000 and a0281='true' and A0201B='%s')`,codes,b0111,b0111)