SQL 如何写根据身份证号的前12位一样查询呢

[复制链接]
查看11 | 回复2 | 2009-8-8 17:02:48 | 显示全部楼层 |阅读模式
select a.*,b.* from table1 as a inner join table 2 as bonsubstring(a.身份证,1,12)=substring(b.身份证,1,12)这么写没有意义,因为有可能身份证书一样的除非你对地区进行划分...
回复

使用道具 举报

千问 | 2009-8-8 17:02:48 | 显示全部楼层
表:t1,t2 身份证号字段id,字符类型select *from t1,t2where substr(t1.id,1,12)=substr(t2.id,1,12)...
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行