SQL转义查询和计算查询(0与1转换为男女)







select count(*) from arv_basinfo a, res_perinfo b where arvtypeid = 'e38bf6bf7a144f7eaa8ee01dfcc7d679' and a.arvid = b.arvid and b.sex = '1' and (2021 - substr(objid,7,4)) >= 60






select a.objnam as 姓名,a.objid as 身份证号,case b.sex when '1' then '男' when '0' then '女' else '未知' end as 性别 from arv_basinfo a, res_perinfo b where substr(repoinfo, 4,1) = '5' and a.arvid = b.arvid

原文地址:https://www.cnblogs.com/xuehu666/p/13930101.html