访问 - 使用内部联接查询更新

时间:2018-04-29 20:35:13

标签: sql ms-access

我有这个问题:

UPDATE client
SET client.[client_history] = 10
FROM  [T_CLIENT] AS client
     INNER JOIN (SELECT [client_id], SUM([final_price])
            FROM [T_PURCHASE]
            GROUP BY [client_id]) AS p
     ON client.[client_id] = p.[client_id]

当我在访问时执行此查询时,我得到"语法错误"。 你看错了吗?

谢谢

2 个答案:

答案 0 :(得分:2)

语法是否在没有FROM的情况下工作:

UPDATE [T_CLIENT] AS client INNER JOIN
       (SELECT [client_id], SUM([final_price])
        FROM [T_PURCHASE]
        GROUP BY [client_id]
       ) AS p
      ON client.[client_id] = p.[client_id]
    SET client.[client_history] = 10;

答案 1 :(得分:2)

您可以使用// Create the React Component class ChooseYourCharacter extends React.Component { // Set the constructor constructor(props) { super(props); this.state = {value: 'coconut'}; // bind the functions this.handleChange = this.handleChange.bind(this); this.handleSubmit = this.handleSubmit.bind(this); } // extract the value to fluently setState the DOM handleChange (e) { var options = e.target.options; var value = []; for (var i = 0, l = options.length; i < l; i++) { if (options[i].selected) { value.push(options[i].value); } } this.setState({value: value}); } // display in client-side the values choosen handleSubmit() { alert("you have choose :" + this.state.value); } (...) 从更新查询中的其他表中求和。具有聚合的子查询将不起作用,因为它们不可更新。

DSUM