表间写记录的SQL..,这个SQL怎么写? insert A (price) (select price from B inner join A on A.code=B.code)? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 update a set price=b.pricefrom a join b on a.code=b.codewhere a.price is null update A set A.price =B.price from B.pricewhere a.code=b.code -----如果全部更新A表中的PRICE字段就写到这里结束 and a.price is null ------如果只更新表A中空price就加上这一句 表A是产品表 (id,code,name)表B是产品价格表 (id,productid,price)表C是产品价格表 (id,code,price)表C只知道产品的CODE,并不知道产品的id每个表的ID是自动生成的记录唯一标记,主键现在是往B表新建记录,条件是A.code=C.code, A.id=B.productid那SQL怎么写insert B (productid,price) value (A.code,C.price) 帮忙写个sql 从sqlserver2000转到sqlserver2005问题 为什么我用Varchar型,但是在数据后面有些数据偷偷地给我补个空格呢? 求一多表查询语句 再开新贴,一个类似于行列转换的问题,望大侠们解决一下,特此感谢,高分赠予! 高分求解,如何在VC中导入TXT到数据库? SQL服务占用服务器CPU100% 关于存储过程2个日期参数问题,百思不得其解 有没有办法限制某个账户在某段时间内没有访问数据库的权限 SQL Server 2005 千万数据查询优化——求建议 求助SQL 有谁知道这是什么错吗?
from a join b on a.code=b.code
where a.price is null
from B.price
where a.code=b.code -----如果全部更新A表中的PRICE字段就写到这里结束
and a.price is null ------如果只更新表A中空price就加上这一句
表B是产品价格表 (id,productid,price)
表C是产品价格表 (id,code,price)表C只知道产品的CODE,并不知道产品的id
每个表的ID是自动生成的记录唯一标记,主键
现在是往B表新建记录,条件是A.code=C.code, A.id=B.productid
那SQL怎么写
insert B (productid,price) value (A.code,C.price)