标题:爆急!!!!!从商品信息表和用户表中查找相关字段然后添加到一张表中。。 ...
只看楼主
恋雪怜冰
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



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-307284-1-1.html




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

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