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

posted on 2020-11-05 09:46  二两老酒  阅读(1078)  评论(0编辑  收藏  举报

导航