| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 536 人关注过本帖
标题:爆急!!!!!从商品信息表和用户表中查找相关字段然后添加到一张表中。。 ...
只看楼主 加入收藏
恋雪怜冰
Rank: 1
来 自:苏州
等 级:新手上路
帖 子:84
专家分:2
注 册:2010-3-11
结帖率:100%
收藏
已结贴  问题点数:20 回复次数:2 
爆急!!!!!从商品信息表和用户表中查找相关字段然后添加到一张表中。。。。。
从商品信息表和用户表中查找相关字段然后添加到一张BuyInfo表中,但写的sql中要加入中要添加一个新的字段,新的字段是BuyInfo中的字段,字段名是num,
sql语句如下:
insert into BuyInfo(
userID,username,telephone,area,Frxed_telephone,note,payment,address,realname,goodid,goodname,price,picture,type,unit,num)
select u.userid,u.username,u.telephone,u.area,u.Fixed_telephone,u.note,u.payment,u.address,u.realname,
       g.goodid,g.goodname,g.price,g.picture,g.type,g.unit
from goodinfo as g , users as u where userid=u.userid and goodid=g.goodid and g.goodid=2 and u.userid=1 and g.goodid=5

添加的num值写在哪个位置。
谢谢!请尽快帮助我。
搜索更多相关主题的帖子: 字段 用户表 商品 
2010-05-19 12:56
aei135
Rank: 9Rank: 9Rank: 9
等 级:贵宾
威 望:12
帖 子:232
专家分:1176
注 册:2009-4-6
收藏
得分:20 
就写在相应位置上啊
insert into BuyInfo(
userID,username,telephone,area,Frxed_telephone,note,payment,address,realname,goodid,goodname,price,picture,type,unit,num)
select u.userid,u.username,u.telephone,u.area,u.Fixed_telephone,u.note,u.payment,u.address,u.realname,
       g.goodid,g.goodname,g.price,g.picture,g.type,g.unit,'num值'
from goodinfo as g , users as u where userid=u.userid and goodid=g.goodid and g.goodid=2 and u.userid=1 and g.goodid=5
2010-05-19 13:16
恋雪怜冰
Rank: 1
来 自:苏州
等 级:新手上路
帖 子:84
专家分:2
注 册:2010-3-11
收藏
得分:0 
谢谢 解决了
2010-05-19 13:37
快速回复:爆急!!!!!从商品信息表和用户表中查找相关字段然后添加到一张表中 ...
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.011161 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved