我正在尝试通过在日期和符号的基础上多个两个列的两个列来更新来自另一个表的多个值

时间:2015-07-09 03:18:07

标签: sql sql-server sql-server-2008

UPDATE wpcurrate
SET usd = (SELECT (mo.price * wpcurrate.midprice) as USD
           FROM mo, wpcurrate
           WHERE wpcurrate.symbol = mo.symbol)
WHERE mo.curdatetime BETWEEN '2015-07-01 12:00:00 AM' AND '2015-07-31 11:59:59 PM'

显示以下错误:

  

Msg 4104,Level 16,State 1,Line 1
  无法绑定多部分标识符“mo.curdatetime”。

     

Msg 4104,Level 16,State 1,Line 1
  无法绑定多部分标识符“mo.curdatetime”。

2 个答案:

答案 0 :(得分:1)

您可以尝试以下代码:

 luck_30.text = profile.luck_30

答案 1 :(得分:1)

UPDATE w
SET w.usd = mo.price * w.wpcurrate.midprice
                 FROM wpcurrate w
Inner Join mo on w.symbol = mo.symbol
WHERE mo.curdatetime  between  '2015-07-01 12:00:00 AM' and '2015-07-31 11:59:59 PM'

您需要执行连接操作才能实现此目的