根据一个表转换成另一个表 本帖最后由 miraclestar 于 2011-04-15 14:02:25 编辑 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 create table if not exists tempispselect A.isp_id as isp_id,B.area_code as isp_namefrom ispip A,iparea Bwhere A.ip=B.ip 谢谢楼上,你理解错了,要转换出的是ispip表,不是tempisptempisp是转换的关系表 (不要高估你的汉语表达能力或者我的汉语理解能力) 建议你列出你的表结构,并提供测试数据以及基于这些测试数据的所对应正确结果。 参考一下这个贴子的提问方式http://topic.csdn.net/u/20091130/20/8343ee6a-417c-4c2d-9415-fa46604a00cf.html 1. 你的 create table xxx .. 语句 2. 你的 insert into xxx ... 语句 3. 结果是什么样,(并给以简单的算法描述) 4. 你用的数据库名称和版本(经常有人在MS SQL server版问 MySQL) 这样想帮你的人可以直接搭建和你相同的环境,并在给出方案前进行测试,避免文字描述理解上的误差。 insert into ispipselect ip,mask,isp_id,_tm,_dtfrom iparea inner join tempisp on iparea.area_code=tempisp.isp_name create table if not exists ispipselect a.ip,a.mask,b.isp_id,a._tm,a._dtfrom iparea a,tempisp bwhere a.area_code = b.isp_name select a.ip,a.mask,b.isp_id,a._tm,a._dt from iparea a,tempisp b where a.area_code=b.isp_name; MySQL自动重启问题 谁写过充值系统(对数据库的操作) My SQL安装运行不了. mysql 建表 innodb表的key_buffer_size参数是否有用? 怎么样才能关闭mysql 出错时的声音啊? 我只能用localhost访问数据库,不能用本机的名字或其它的名字吗? MySQL Connector/J 3.0 支持 MySQL4.0.12吗? mysql replication 同步机制 mysql存储过程一个参数有多个逗号分割 图片问题 mysql 连续求和问题
select A.isp_id as isp_id,B.area_code as isp_name
from ispip A,iparea B
where A.ip=B.ip
建议你列出你的表结构,并提供测试数据以及基于这些测试数据的所对应正确结果。
参考一下这个贴子的提问方式http://topic.csdn.net/u/20091130/20/8343ee6a-417c-4c2d-9415-fa46604a00cf.html
1. 你的 create table xxx .. 语句
2. 你的 insert into xxx ... 语句
3. 结果是什么样,(并给以简单的算法描述)
4. 你用的数据库名称和版本(经常有人在MS SQL server版问 MySQL)
这样想帮你的人可以直接搭建和你相同的环境,并在给出方案前进行测试,避免文字描述理解上的误差。
select ip,mask,isp_id,_tm,_dt
from iparea inner join tempisp on iparea.area_code=tempisp.isp_name
select a.ip,a.mask,b.isp_id,a._tm,a._dt
from iparea a,tempisp b
where a.area_code = b.isp_name